简体   繁体   中英

iOS 6 facebook sdk 3.1.1 login error

I tried to login using facebook followed the facebook tutorial in https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/3.1/ to implement it but after the alert view asking me to allow my app use your data and press ok the error

The operation could not be completed . (com.facebook.sdk error 2)

note that iam in the simulatore and i entered FB my account inside setting and it is logged correctly.

debugging the issue it and the result of the error is as following :

(NSError *) $1 = 0x0ac77290 Error Domain=com.facebook.sdk Code=2 "The operation couldn't be completed. (com.facebook.sdk error 2.)" UserInfo=0xac77450 {com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:ErrorLoginFailedReason, com.facebook.sdk:ErrorInnerErrorKey=Error Domain=com.apple.accounts Code=7 "The Facebook server could not fulfill this access request: no stored remote_app_id for app" UserInfo=0xaa91d40 {NSLocalizedDescription=The Facebook server could not fulfill this access request: no stored remote_app_id for app}}

You need to provide your app bundle id in app settings on developers.facebook.com

iOS 6 Facebook posting procedure ends up with "remote_app_id does not match stored id"

从Device Setting's退出Facebook后,它对我有用。

This kind of error could be come due to this reason:-

  1. Might be your bundle id is different over developers.facebook.com/aaps

  2. your are might be not giving right permission to your app.

  3. You are not enabling facebook app in your iphone facebook settings.

Please follow given below link

Facebook Registration : The operation couldn't be completed (com.facebook.sdk error 2)

I hope this would clear your all doubt.

In ios 6 with fb sdk 3.1.1. Please pass permissions param as "nil or email" in "[FBSessio openActiveSessionWithReadPermissions..." method. Here my code it was works great.

#define IOS_NEWER_OR_EQUAL_TO_6 ( [ [ [ UIDevice currentDevice ] systemVersion ] floatValue ] >= 6.0 )

-(void)showFBLogin
{
    [FBSession.activeSession closeAndClearTokenInformation];

    NSArray *permissions = [NSArray arrayWithObjects:@"email, publish_actions, publish_stream", nil];

#ifdef IOS_NEWER_OR_EQUAL_TO_6
    permissions = nil; or NSArray *permissions = [NSArray arrayWithObjects:@"email",nil];
#endif

    NSLog(@"\npermissions = %@", permissions);
    [FBSession openActiveSessionWithReadPermissions:permissions
                                       allowLoginUI:YES
                                  completionHandler:
     ^(FBSession *session,
       FBSessionState state, NSError *error) {
         NSLog(@"\nfb sdk error = %@", error);
         switch (state) {
             case FBSessionStateOpen:
                 [[FBRequest requestForMe] startWithCompletionHandler:
                  ^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
                      if (!error) {
                          //success
                      } 
                  }];
                 break;
             case FBSessionStateClosed:
                 //need to handle
                 break;
             case FBSessionStateClosedLoginFailed:
                 //need to handle
                 break;
             default:
                 break;
         }
     }];
}

This worked for me:

Go to the settings app of your iPhone. Open your Facebook Settings Scroll down to your app and make sure your app allows facebook interaction.

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