简体   繁体   中英

Fetching data from Facebook SDK to iOS app

How can I fetch data from facebook to my app. I need fetch name, age, gender, profile picture and other picture. I must put these data to labels and UIView, just like this: self.labelName.text = userID.name...

I use this code but is no working with Facebook SDK 4.0 and higher:

-(void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user{
NSLog(@"%@", user);
self.profilePicture.profileID = user.id;
self.labelName.text = user.name;
self.gender.text = [user objectForKey:@"email"];}

And what if user doesn't have all info, ex. gender or age?

Facebook integration needs following steps

1) Go to developer.facebook.com and register your app.
2) get the api key for your application.
3) Drag drop SDK in your application bundle.
4) Request for specific information to user.

You can find more information along with demo on www.developer.facebook.com

Login with Facebook

FBGraph api

Facebook integration demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM