+(void)fetchCurrentUser:(UIViewController *)viewController{
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:@"id,first_name,last_name,name,email,picture.width(100),friends.summary(true),link,permissions",@"fields", nil];
if ([FBSDKAccessToken currentAccessToken]) {
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:params]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error) {
// Log(@"fetched user:%@", result);
// Here you can notify your backend service about new user
}];
}
}
1 回答
Facebook iOS SDK 将为您完成所有的誓言。我在我的应用程序中的方式。