问题
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}}
回答1:
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"
回答2:
It worked for me after signing out of facebook from Device Setting's.
回答3:
This kind of error could be come due to this reason:-
Might be your bundle id is different over developers.facebook.com/aaps
your are might be not giving right permission to your app.
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.
回答4:
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;
}
}];
}
回答5:
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.
来源:https://stackoverflow.com/questions/13177429/ios-6-facebook-sdk-3-1-1-login-error