我在iPhone应用程序中使用Facebook登录,但是当我点击登录按钮并启动FBSession
时,它显示错误“您还没有登录:您还没有登录。请登录并重试。“
以下是我正在使用的代码:
FBSession *session = [[FBSession alloc] initWithAppID:FacebookID
permissions:[NSArray arrayWithObjects:@"publish_actions",@"read_stream",@"public_profile",@"email", nil]
urlSchemeSuffix:nil tokenCacheStrategy:nil];
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
[[FBSession activeSession]handleDidBecomeActive];
[[FBSession activeSession] closeAndClearTokenInformation];
[FBSession setActiveSession:nil];
[FBSession setActiveSession:session];
FBSessionLoginBehavior behviour = FBSessionLoginBehaviorForcingWebView;
[session openWithBehavior:behviour completionHandler:^(FBSession *session1, FBSessionState status, NSError *error) {
if (error) {
NSLog(@"error %@",error.localizedDescription);
[appDelegate removeHudView:nil];
}
if (session1.accessTokenData.accessToken) {
}
}];
还有我的模拟器的屏幕排序。
如果有人知道如何处理此案,请帮助我。