1

是否可以通过授权流程捕获事件“ CancelButtonPressed” ?Facebook Appfacebook-ios-sdk

我使用相当旧的版本Facebook SDK for IOS并像这样打开会话:

[_facebookSession openWithBehavior:FBSessionLoginBehaviorWithNoFallbackToWebView
                             completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
                NSLog(@"this is FBSession State: %d",status);
                NSLog(@"this is NSError: %@",error);
                NSLog(@"create new session with permissions: %@",_facebookSession.permissions);
            }];

我看到了这个问题,但也许有些东西改变了Facebook IOS SDK

也许有人知道答案或好的解决方案?

感谢帮助!

编辑:

if ([_facebookSession state]==FBSessionStateCreatedOpening){
    // if we call FBApp, facebook session will be in this state (createdOpening)
    // and we need to check it and close, to recall FBApp
    [_facebookSession closeAndClearTokenInformation];
    // and now recrate session and open it ;)
    _facebookSession = [[FBSession alloc] initWithAppID:kAppId
                                                    permissions:permissions
                                                urlSchemeSuffix:nil
                                             tokenCacheStrategy:[FBSessionTokenCachingStrategy defaultInstance]
                                ];

    //and reopen it like `[_facebookSession openWith... ];`
}
4

0 回答 0