ios - The operation couldn’t be completed. (com.facebook.sdk error 2.) ios6 -
hi ussing ios6 facebook login , getting error native popup
the operation couldn’t completed. (com.facebook.sdk error 2.)
this scenario ive used. (i running on simularor)
i have logged in facebook app through settings , tried login app , working fine.
then logged out of facebook settings , logged in again different user. tried login app. getting error.
i tried loging out of app using command
[fbsession.activesession closeandcleartokeninformation];
but no use.
the bundle identifier in facebook app same in ios app.
this code used login
nsarray *permissions = [[nsarray alloc] initwithobjects:@"email", nil]; [fbsession openactivesessionwithreadpermissions:permissions allowloginui:yes completionhandler: ^(fbsession *session, fbsessionstate state, nserror *error) { [self sessionstatechanged:session state:state error:error]; }];
any appreciated.
this error getting
domain=com.facebook.sdk code=2 "the operation couldn’t completed. (com.facebook.sdk error 2.)" userinfo=0x9535330 {com.facebook.sdk:errorloginfailedreason=com.facebook.sdk:systemlogindisallowedwithouterror, com.facebook.sdk:errorsessionkey=, expirationdate: (null), refreshdate: (null), attemptedrefreshdate: 0001-12-30 00:00:00 +0000, permissions:(null)>}
note got same error on different occation. @ time bug in code
instead of giving permission
nsarray *permissions = [[nsarray alloc] initwithobjects:@"email",@"birthday", nil];
i wrongly doing
nsarray *permissions = [[nsarray alloc] initwithobjects:@"email,birthday", nil];
solution after correcting code, getting same error. have logout , login facebook ios settings screen. once did correct code never caused problem. note problem occured on device executed buggy code. note sure caused problem, hope info helps
this worked me:
- go settings app of iphone.
- open facebook settings
- scroll down app , make sure app allows facebook interaction.
this happen on device, therefore in app have make sure handle error correctly. reckon give user feedback why login facebook failed , ask user check facebook settings on device.
- (void)facebooksessionstatechanged:(fbsession *)session state:(fbsessionstate)state error:(nserror *)error { switch (state) { case fbsessionstateopen: // handle successful login here case fbsessionstateclosed: case fbsessionstateclosedloginfailed: [fbsession.activesession closeandcleartokeninformation]; if (error) { // handle error here, example showing alert user uialertview *alert = [[uialertview alloc] initwithtitle:@"could not login facebook" message:@"facebook login failed. please check facebook settings on phone." delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [alert show]; } break; default: break; }
Comments
Post a Comment