Can't get NSDate to work correctly

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-04-25T18:43:12Z Indexed on 2010/04/25 18:43 UTC
Read the original article Hit count: 246

Filed under:
|
|

Hello, having a strange issue, must be something I'm just not seeing.

I set up a variable in the .h

NSDate *checkIn;

@property (nonatomic, retain) NSDate *checkIn;

I'm setting a variable to todays date in the initWithNibName:

checkIn = [NSDate date];

I also did synthesized it as well. Now later on in my program I use it to build a tablecell with the following line

cell.textLabel.text = [dateFormatter stringFromDate:checkIn];

This line kills the simulator, BAD_EXEC. If I put in a checkIn = [NSDate date]; above it, it works fine. So I'm thinking the variable isn't being stored from when I set it in the initWithNibName:

Not sure why though, as my strings I do the same way are all working fine from method to method. What am I missing?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c