Search Results

Search found 1 results on 1 pages for 'therealtkd'.

Page 1/1 | 1 

  • NSDate out of scope

    - by therealtkd
    Having problems with out of scope for NSDate in an iphone app. I have an interface defined like this: @interface MyObject : NSoObject { NSMutableArray *array; BOOL checkThis; NSDate *nextDue; } Now in the implementation I have this: -(id) init { if( (self=[super init]) ) { checkThis = NO; array = [[NSMutableArray alloc] init]; nextDue = [[NSDate date] retain]; NSDate *testDate = [NSDate date]; } return self; } Now, if I trace through the init, before I actually assign the variables checkThis shows as boolean. array shows as pointer 0x0 because it hasn't ben assigned. But the nextDue is showing as 'out of scope'. I don't understand why this is out of scope but the other variables aren't. If I trace through the code until after the variables are assigned, array now shows as being correctly assigned but nextDue is still out of scope. Interestingly, the testDate variable is assigned just fine and the debugger shows this as a valid date. Further interesting point is if I move the mouse over the testDate variable while I am debugging, it shows as an 'NSDate *' type which I would expect since that's its definition. Yet the nextDue, which to me is defined the same way is showing as a '_NSCFDate *'. Any googling I did on the subject said that the retain is the problem, but its actually out of scope before I even try to assign the variable. However, in another class, the same definition for NSDate work ok. It shows as nil before a value is assigned to it. Arghhh

    Read the article

1