I'm developing a iOS
app for iPad
. I've implemented Instagram
API
so I can get and use the photos from the user. Can I do the same but with Facebook? Is there any way to access to users' pictures?
Thanks
The Graph API is where you want to start to see what data you're looking for. For user photos, check out: Albums user has created - https://developers.facebook.com/docs/reference/api/user/ Info about a photo - https://developers.facebook.com/docs/reference/api/photo/
I recommend trying different queries using the Graph API explorer: https://developers.facebook.com/tools/explorer First make sure you ask for user_photos permission Entering me/albums in the query gives you a list of albums for the logged in user. Click on an album's ID in the results to see the info for that album. Enter /photos to see photos for that album.
Once you know what you want you can take a look at the iOS SDKs that are built on top of the Graph API and other APIs to authenticate and for what you're interested in, to grab photos.
For iOS SDK info on making requests, see: https://developers.facebook.com/docs/reference/ios/3.1/class/FBRequestConnection#startWithGraphPath%3AcompletionHandler%3A
So if you want to see say the photos for one album, given an album_id, you would use request code like:
[FBRequestConnection startWithGraphPath:@"<album_id>/photos"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
NSLog("Results: %@", result);
}
}
];
Make sure you've asked for user_photos permissions first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With