I have the following code:
NSNumber *rowValue = [movieDescription objectAtIndex:film];
NSLog(@"ROWVALUE %@",rowValue);
NSUInteger converted = rowValue;
NSLog(@"UNIX %@",converted);
NSDate *date = [NSDate dateWithTimeIntervalSince1970:converted];
NSLog(@"TODAYS DATE %@",date);
This is outputing to the debugger console:
2011-03-24 14:55:37.330 ViRe[27540:307] ROWVALUE 1300906517
2011-03-24 14:55:37.332 ViRe[27540:307] UNIX 1300906517
2011-03-24 14:55:37.338 ViRe[27540:307] TODAYS DATE 1970-01-29 00:12:00 +0000
Clearly this is wrong but I can't see how/why?
Any advice? Thanks
To convert an NSNumber to NSUInteger, use NSNumber's unsignedIntegerValue method and to log an NSUInteger, use %u instead of %@ (see String Format Specifiers):
NSUInteger converted = [rowValue unsignedIntegerValue];
NSLog(@"UNIX %u",converted);