I have NSTimeInterval and I have a JSON value of 1257808000000 .
NSTimeInterval
1257808000000
I'm doing it:
NSTimeInterval *myTimestamp = [myJSON objectForKey:@"thetimestamp"];
But I get this warning:
Incompatible pointer types initializing 'NSTimeInterval *' (aka 'double *') with an expression of type 'id'
How can I solve this problem?
Best wishes.
NSTimeInterval is actually a double value. This is not an object.
NSTimeInterval myTimestamp = [[myJSON objectForKey:@"thetimestamp"] doubleValue];
if your object for the @"thetimestamp" key is NSString or NSNumber , then
@"thetimestamp"
NSString
NSNumber
Try
NSTimeInterval *myTimestamp = (NSTimeInterval*)[myJSON objectForKey:@"thetimestamp"];