Please login to this app again to reconnect with Facebook

We are using:

Parse - 1.8.3 FBSDK.* - 4.6.0 ParseUI - 1.1.6 ParseFacebookUtilsV4 - 1.8.3 IOS Target - 9.0

Here is our issue. A user is logged into the app fine. They go into Facebook.com->Account->Settings and deauthorize the app (remove it entirely).

When the user launches our app again, they are greeted with a dialog from the FBSDK that says "Please login to this app again to reconnect with Facebook" (options are OK and Cancel).

I have googled/SO this and seen others with this issue, but in their case it is slightly different (and perhaps functional). This is because, when you click "OK" in that dialog, it does nothing. It appears that clicking ok is supposed to go do a login flow (which would be stellar), but again - it just does nothing.

I have tapped into the Notifications broadcast by the FBSDK and can see that I get a notification for:

com.facebook.sdk.FBSDKAccessTokenData.FBSDKAccessTokenDidChangeNotification

as a result of a error code 190 and sub_code 458.

My question is two part: 1) How do I get my "ok" button in the FBSDK Dialog that is automatically presented to actually DO something with the ok button? 2) How do I manually (assuming that the button above isn't working for some reason) test for the accessToken state and reauthorize the user?

This seems like there has to be a simple solution and I have spent a few days on it and cannot get ahead of this.

Thanks for any help or guidance!


I ran into a similar problem (it has nothing to do with Parse though). Here are my answers to the two questions you asked:

  • It seems the FBSDK dialog's OK button doesn't work for this reason:

    Attempt to present <FBSDKContainerViewController: 0x126b222a0> on
    <FBSDKContainerViewController: 0x126a26d10> whose view is not in the window hierarchy!
    

    At least I see the above warning in the Xcode console when I try to log in to Facebook in my app (on a device connected to a Macbook) and my attempt fails. I didn't find a way to work around this particular problem. But I found a way to avoid the FBSDK dialog. See the next item.

  • I test for the validity of the accessToken by requesting the information about the FB user. If the request fails with an error, it may mean that the accessToken is not valid. Here is a code sample:

    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] 
        initWithGraphPath:@"me" parameters:@{@"fields": @"id, first_name, last_name"}];
    
    // The next line is important. 
    // It prevents FB SDK from handling the error automatically 
    // and allows you to handle the error yourself. 
    // In this way you avoid(!) the FBSDK dialog that says 
    // "Please login to this app again to reconnect with Facebook".
    [request setGraphErrorRecoveryDisabled:YES];
    
    [request startWithCompletionHandler:
        ^(FBSDKGraphRequestConnection *connection, id result, NSError *error){ 
    
        if (error) {
          // An error occurred. Most likely the accessToken is not valid.
          // Start the FB log-in process to obtain a valid token.
        }else{
          // Everything's all right. Go on.
        }
    }];
    
  • 链接地址: http://www.djcxy.com/p/30492.html

    上一篇: 在Android上的任务管理器中杀死应用程序时代码停止运行的位置

    下一篇: 请再次登录到这个应用程序重新与Facebook连接