1

I am using Facebook sdk in my app and I'm try to login with Facebook button.
This is work in simulator and iPhone 4 but when I'm using iPhone 5 then it's show following error:

error Error Domain=com.facebook.sdk Code=2 "The operation couldn’t be completed. (com.facebook.sdk error 2.)" UserInfo=0x1766e9c0
{com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:SystemLoginCancelled, com.facebook.sdk:ErrorInnerErrorKey=Error Domain=com.apple.accounts Code=7 "The operation couldn’t be completed. (com.apple.accounts error 7.)", 
com.facebook.sdk:ErrorSessionKey=<FBSession: 0x1762f0c0, state: FBSessionStateClosedLoginFailed, loginHandler: 0x0, appID: 733184070029762, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x17506a20>, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>} 

my code is here:

    if ([[FBSession activeSession] isOpen]) {
        /*
         * if the current session has no publish permission we need to reauthorize
         */
        // if ([[[FBSession activeSession] permissions]indexOfObject:@"public_profile"] == NSNotFound)
        {

            [[FBSession activeSession] requestNewReadPermissions:[NSArray arrayWithObject:@"public_profile"]
                                               completionHandler:^(FBSession *session,NSError *error){
                                                   //[self postPhoto];
                                                   [FBRequestConnection
                                                    startForMeWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                                                        if (!error) {
                                                            NSLog(@"error %@",result);

                                                            NSString *facebookId = [result objectForKey:@"id"];
                                                            NSLog(@" facebook %@",facebookId );
                                                            [self fb_link_check:facebookId];
                                                        }
                                                  }];

                                        }];

        }

      }
    else
    {

        FBSession* session = [FBSession activeSession];
        [session closeAndClearTokenInformation];
        [session close];
        [FBSession setActiveSession:nil];
        [FBSession openActiveSessionWithReadPermissions:[NSArray arrayWithObject:@"public_profile"] allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
            if (!error && status == FBSessionStateOpen) {
                // [self publishStory];
                [FBRequestConnection
                 startForMeWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                     if (!error) {
                          NSLog(@"error %@",result);
                         NSString   *facebookId = [result objectForKey:@"id"];
                         NSLog(@" facebook %@",facebookId );
                         [self fb_link_check:facebookId];
                     }
                 }];

            }else
            {

                NSLog(@"error %@",error);
            }
        }];

    }

So, can any one help me on this.
Also, there is another thing that when we download new facebook sdk 3.16.1 and click on it for installation, it give following error:

     The operation couldn’t be completed. (com.apple.installer.pagecontroller error -1.)
     Couldn't open "facebook-ios-sdk-3.16.1(1).pkg".
Atur
  • 1,712
  • 6
  • 32
  • 42
Rahul Sharma
  • 940
  • 2
  • 12
  • 31
  • http://stackoverflow.com/questions/15831610/the-operation-couldn-t-be-completed-com-facebook-sdk-error-2-ios6 Hope it helps – Iphonenew Jul 24 '14 at 08:49

0 Answers0