Reputation: 21
I've been trying to retrieve the Facebook friends ids of my ios app's user.
I am using ios facebook sdk 3.17.1. I can easily retrieve the name and the id of the user with the following code:
-(void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user
{
NSLog(@"My Name is: %@ and user ID is: %@", user.name, user.objectID);
}
Then, I want to get the friend list of the user with the following code:
-(void)pickFriendsList
{
FBRequest *friendRequest = [FBRequest requestForGraphPath:@"/me/taggable_friends"];
[friendRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
NSArray *friends = [result objectForKey:@"data"];
for (FBGraphObject<FBGraphUser> *friend in friends)
{
NSLog(@"%@:%@", [friend name],[friend objectID]);
}
}];
}
then, I call this new function as below:
-(void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user
{
NSLog(@"My Name is: %@ and user ID is: %@, birthday: %@", user.name, user.objectID);
[self pickFriendsList];
}
Running the code, I can see the names of the user's friends. However, the friends' ids seem to be weird.
For example, for one user I check the facebook id and see "562641652", however the code shows the id as: AaI5Iprd8S7PhWD8bBuw2Gr1bFlo2N_H6xQqikcqR2zztDT31N-VBIREBcpUZLicYESDY-Wh7g8AutN5XEbYh_DVT-y815c-nZpIryiXD7uugA
I thought maybe I see the encrypted version of the id but found no way to convert it.
I'll be grateful to be taken out from this problem..
By the way, I am using XCode 5, developing an ios app for ios 7.
Upvotes: 2
Views: 241
Reputation: 15
As specified in the documentation this Id is a tagging token which can only be used in order to tag this friend, and for no other purpose. This token should not be considered a stable ID, and cannot be used to identify the friend outside the context of tagging them in stories. If you are trying to get other friends details using this Id it is not possible as the new-API does not support this.
Upvotes: 1