I have these two lines inside a block that is called when the app is about to quit
NSTimeZone* systemTimeZone = [NSTimeZone systemTimeZone];
NSTimeInterval delta = [systemTimeZone daylightSavingTimeOffset];
I have these lines there for weeks. They were working perfectly. Now, the app crashes on the second line showing this error:
-[NSCFString daylightSavingTimeOffset]: unrecognized selector sent to
instance 0x1534b0Terminating app due to uncaught exception
‘NSInvalidArgumentException’, reason: ‘-[NSCFString
daylightSavingTimeOffset]: unrecognized selector sent to instance
0x1534b0’**
what? any clues? thanks.
If those lines are being called in order and you are getting that message it looks you are over releasing the systemTimeZone somewhere. It just so happens that a valid
NSString*is occupying the memory where the cached systemTimeZone was stored.According to the documentation:
So consider this
Where I get my
EXC_BAD_ACCESSit would also be possible for an NSString* to reside there as I mentioned earlier and that would result in exception being raised. So just make sure you are not improperly releasing it anywhere.