NSDate turns into NSNumber MYSTERY

I work in iOS 4.3 and iOS 5 with automatic reference counting. I declare an NSDate object in my interface:

NSDate *fingerprintsDate;

Later, I found that NSDate - using the debugger and stepping over it, has the value that I would expect:

fingerprintsDate = [NSDate date];

Finally, I try to get the time from the day:

if (fingerprintsDate == nil || [fingerprintsDate timeIntervalSinceNow] > 6)

And that where it falls with the unrecognized selector: "2012-01-18 23: 07: 46.662 Netapporter [473: 707] - [NSCFNumber timeIntervalSinceNow]: unrecognized selector sent to instance 0x194490"

According to the debugger, my dear NSDate reads: "fingerprintsDate = (NSCFNumber *) 0x194490 139" - when I print a description, it reads: "{value = +139.0000000000, type = kCFNumberFloat32Type}"

I don't do anything w / fingerprintsDate anywhere else in the code, but somehow it turns into NSNumer ... Any ideas how to stop it?

+5
source share
2 answers

[NSDate date] returns an unchanged value (or weak if you use an arc), so most likely it was released somewhere between this destination and the call of [fingerprintsDate timeIntervalSinceNow]. When you assign it to a saved (strong) property, it is saved.

0
source

All Articles