0
votes

In my app, I've implemented FaceBook integration, it works properly when my app is running in the device which doesn't have Facebook App so it directly open up the Facebook login in the Safari web browser but when I run the same in Facebook App installed device it won't open up the Facebook login page? I don't know what is the issue? Please help me.

Here is the code:

if (FBSession.activeSession.accessTokenData.loginType != FBSessionLoginTypeFacebookApplication || FBSession.activeSession.accessTokenData.loginType != FBSessionLoginTypeSystemAccount) { [FBSession openActiveSessionWithReadPermissions:@[@"public_profile", @"email", @"user_friends"] allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState state, NSError *error) { [FBSession setActiveSession:session]; switch (state) { case FBSessionStateOpen:{

                                              [[FBRequest requestForMe] startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
                                                  if (error) {
                                                      [HUD hide:YES];
                                                      NSLog(@"error Report :%@",error);
                                                  }
                                                  else
                                                  {


                                                      [FBRequestConnection startWithGraphPath:@"me/feed"
                                                                                   parameters:params
                                                                                   HTTPMethod:@"POST"
                                                                            completionHandler:^(FBRequestConnection *connection,
                                                                                                id result,
                                                                                                NSError *error)
                                                       {

                                                                                                       }];
                                              break;
                                          }
                                          case FBSessionStateClosed:{

                                          }
                                          case FBSessionStateClosedLoginFailed:{

                                              }
                                              break;
                                          }
                                          default:
                                              break;
                                      }
                                  } ];
    }

    else{

   }

*

1
How have you implemented Facebook integration? Be more clear about the problem you are facing. Can you please post some code too?duci9y

1 Answers

0
votes

Since your facebook login works just fine when you do not have the facebook app installed, I think that it is safe to assume that your facebook login code is just fine (same code is sufficient with and without facebook app's presence). What is likely to be the issue is that you have somehow disabled facebook login for YOUR APP at some point. This is sometimes mistakenly done when you click "Don't Allow" when facebook initially asks for permission to access your profile. Unfortunately, after denying facebook access the first time, facebook login for YOUR APP gets saved in the actual facebook app's settings. All subsequent login attempts will not work and there will be no dialog box notifying why. To fix this, navigate to Settings app--> Facebook. Scroll down to the section that says, "Allow these apps to use your account", and switch on access for YOUR APP.