Using IDs in Facebook ( unsigned long long ) (objective c)

Safest bet when handling facebook ids is to user a NSString for handling them. If you are still keen on using an int, you better use unsigned long long, since the just using unsigned long will give you a error. Below is an example on how to do this :
[sourcecode lang=”objc”]
NSNumberFormatter * f = [[NSNumberFormatter alloc] init];
[f setNumberStyle:NSNumberFormatterNoStyle];
NSNumber * myNumber = [f numberFromString:[userData objectForKey:@"id"]];
[user setUserId:[myNumber unsignedLongLongValue]];

Leave a Reply

Your email address will not be published. Required fields are marked *