简体   繁体   中英

ios Facebook Login showing “Invalid Scope: basic_info”. use public_profile, user_friends instead

I want app should works in all three condition.
I'm using following code in my viewdidload method and implemented delegate method.

FBLoginView *fb_loginView = [[FBLoginView alloc] init];
fb_loginView.readPermissions = @[@"basic_info", @"email", @"user_friends"];
fb_loginView.delegate = self;
fb_loginView.frame = CGRectMake(10, 250, 300, 100);
[self.view addSubview:fb_loginView];

Case-I working fine But Case-II & Case-III not working

Case-I : (FB app is not installed on device & only FB credentials is stored in settings) In this case when I pressed on login button its ask me permissions and I can fetched users basic info.

Case-II : (FB app is installed But FB credentials is not stored in settings) In this case when I pressed on login button its takes me to FB installed for login. I logged in, but showing error "Invalid Scope: basic_info". use public_profile, user_friends instead.

Case-III : (FB app is not installed and FB credentials is not stored in settings) In this case when I pressed on login button its takes me to ios safari browser for fb login. I logged in, but showing same error "Invalid Scope: basic_info". use public_profile, user_friends instead.

When I used

fb_loginView.readPermissions = @[@"public_profile", @"email", @"user_friends"]; 

Then Case-I & Case-II works fine but Case-III showing following error.

Error = Error Domain=com.facebook.sdk Code=2 "The operation couldn't be completed. (com.facebook.sdk error 2.)" UserInfo=0x1cd61ba0 {com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:SystemLoginCancelled, com.facebook.sdk:ErrorInnerErrorKey=Error Domain=com.apple.accounts Code=7 "The Facebook server could not fulfill this access request: The proxied app cannot request publish permissions without having being installed previously." UserInfo=0x1cd622e0 {NSLocalizedDescription=The Facebook server could not fulfill this access request: The proxied app cannot request publish permissions without having being installed previously.}, com.facebook.sdk:ErrorSessionKey=, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>}

The error tells you how to fix it.

@"basic_info" is no longer accepted by the Facebook API. You should be using @"public_profile" or @"user_friends" , or @[@"public_profile", @"user_friends"] instead (depending on your use case).

The error that you are seeing when you have used @"public_profile" is not related to this Facebook request. It is related to a request where you have requested @"publish_actions" , hence the message "The proxied app cannot request publish permissions without having being installed previously."

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