I want to get the unsigned long value of a NSNumber. I don´t know why, but it doesn't work. Here is what I did:
NSString * s开发者_Go百科tern = [idd objectAtIndex:indexPath.row]; // get a String with Number from a NSArray
NSNumberFormatter * lols = [[NSNumberFormatter alloc] init];
NSNumber * iddd = [lols numberFromString:stern];
NSLog(@"%@", iddd); // I get the right number: 8084143463
unsigned long fooo = [iddd unsignedLongValue];
NSLog(@"%lu", fooo); // I get the wrong number: 3789176167
[twitterEngine deleteUpdate:fooo];
8084143463 == 0x1e1da3d67
3789176167 == 0x0e1da3d67
The size of a long on a 64bit system is 8 bytes. The size of a long on a 32bit system (like the iPhone) is 4 bytes. You need to use a long long
on an iPhone to store that value.
Your value is larger than the maximum value an unsigned long can hold (2^32 - 1 == 4,294,967,295) in 32-bit mode.
精彩评论