views:

13

answers:

1
  • I have a general timer with a 1.5 second interval (the render cycle).
  • I have a class with an NSDate* member/property (nonatomic, retain).
  • I set this date by calling [callingClass setDate:expirationDate];

Now... a couple of render cycles this NSDate is valid. However, around the 3rd cycle the value of this variable gets corrupted, it seems.

When i set a break-point i notice that i can hover the mouse and see the data displayed properly (when its valid). But when its invalid i either see "out of scope", some weird strings (looks kinda like library file names or something), or in rare cases the debugger wont show me the value of any variable (i hate debugging in xcode).

So this is why i think this variable is getting corrupted somehow. Should i be setting this synthesized property as (nonatomic, retain)? Or should it be declared as something else?

A: 

I think i found the problem. I have a method called: - (NSDate*) getNSDateFromString:(NSString*)stringDate;

When i called this i was doing NSDate *date = [self getNSDateFromString:expirationString]; This was causing the behavior i described above.

Then i changed it to the following which eliminated the crashings:

NSDate *date = [[self getNSDateFromString:expirationString] retain]; // do something with the date here... [data release];

AlvinfromDiaspar