简体   繁体   中英

How to get profile picture from FBLoginView?

Please help me to get Facebook Profile Picture using FBLoginView.

Not setting FBProfileImageView. I want to get the UIImage of Profile Picture.

NOTE : Not using Custom Facebook Login. I am using FBLoginView for login.

After login View we get users ID,email,gender and many more things so we can use user ID or objectID to get the user Profile Image.

-(void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user
{        
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?type=normal",user.id]];
    NSData  *data = [NSData dataWithContentsOfURL:url];
    UIImage *profileImage = [UIImage imageWithData:data];
}

profileImage would contain the user profile Image and you can use that.

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