Reputation: 9269
I use a Facebook Friend Picker in my iOS application. When I pick a friend I will only get a App Scoped ID but I need the Facebook ID to get the profile picture and name from that friend.
Is it possible to convert the App Scoped ID to the normal Facebook ID or retrieve that data with the App Scoped ID?
I read a lot about it https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids but can't find a solution.
UPDATE
I'm trying to get the profile picture like this (worked before with the normal Facebook ID):
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?type=large&access_token={access_token}|{secret}", item.giftID]];
NSData *tempData = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:url] returningResponse:nil error:nil];
I would then put the tempData
in an UIImageView
like this:
UIImageView *profilePic = (UIImageView *)[myCell viewWithTag:1];
profilePic.image = [UIImage imageWithData:tempData];
But this doesn't seems to work with the new API call, any ideas on how to fix it?
Upvotes: 0
Views: 1367
Reputation: 9269
I found another way of retrieving the Profile Picture with the Scoped App ID, it was pretty easy after all.
http://graph.facebook.com/ScopedAddID/picture?type=normal
This code did the job.
Upvotes: 3
Reputation: 15457
You can get the user's name or picture by using your App ID and Secret in the API Call:
https://graph.facebook.com/{app_scoped_id}?fields=name,picture&access_token={app_id}|{app_secret}
This will give you the requested details for the user, for example:
{
"name": "Niraj Shah",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/v/t1.0-1/c58.40.500.500/s50x50/18400_10100210273961696_245749691_n.jpg?oh=42982af99b925b1167e52f82eb8316c3&oe=5485298D&__gda__=1418016600_1e8a22c1ac6366f6dbad85990c817e65"
}
},
"id": "10100392436431646"
}
Upvotes: 0