0

In my application I need to know the user's Facebook uid. I get by using the following query using the Facebook API for IOS.

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               @"SELECT uid, name, email, pic, sex, timezone, religion, birthday_date, hometown_location, interests, about_me, locale, sports, relationship_status, languages, work, games, affiliations, current_location FROM user WHERE uid=me()", @"query",
                               nil];

....

fb_udid = [[result objectForKey:@"uid"] retain];
fbid = [fb_udid intValue]; // This int value is always 9-digit

With all users always get nine-digit identifiers. (Always nine-digit!) (www.facebook.com/123456789)

My problem is this: there is a user that returns a uid of ten digits, and that has nothing to do with the right uid.

The real user id is 9-digits and instead says it is 10-digits.

Does anyone know why I do not resolve the identifier correctly? Could it be that the user has removed the permissions to the application? Does anyone know if all identifiers are nine digits facebook?

Thank you very much for your help

Adagio
  • 735
  • 10
  • 20

1 Answers1

1

Does anyone know if all identifiers are nine digits facebook?

No, of course they are not.

And you shouldn’t treat them as numbers in your app, because there is possible danger of f.e. integer overflows corrupting them.

CBroe
  • 91,630
  • 14
  • 92
  • 150
  • As far as I know the newer registered members of facebook have 10 digit uid. I'm confused as to why this would make a difference in your app though. – mkral Jun 13 '12 at 18:15
  • 2
    Like I said, handling FB uids as INT can easily become problematic (depending on platform). Treat them as strings. – CBroe Jun 13 '12 at 18:37
  • Yes, I agree with @CBroe completely. I was just trying to tell Adagio that newer registered users have 10 digit uid's. If you handle them as strings you should have no problems with using them interchangeably. – mkral Jun 13 '12 at 19:09
  • The problem was the casting to integer. You were right. Thank you very much! – Adagio Jun 14 '12 at 17:03