ios - Xcode Facebook登录错误已关闭

标签 ios xcode facebook

嗨,我在http://developers.facebook.com/上阅读和阅读教程。

关于登录Facebook并发布应用程序的Feed,我的问题是我根本无法登录Facebook。

而且我无法正常工作。令人讨厌,烦人,对此没有明确的教程/说明。

我尝试从我的应用登录,然后打开Safari浏览器,然后该URL就像发疯一样
闪烁

而且我没有收到错误,为什么?

是否有关于登录的CLEAR教程?

它可以在模拟器上很好地运行,但不能在设备上运行。

我目前在Xcode 4.5 Beta上,但在4.4上也无法使用。

我需要帮助!

[CLOSED]

编辑:我已解决问题!我真是愚蠢……我为了登录FB挣扎了7天,
然后我进行了更改(设备上的 Cookies允许),一切正常!

该死的设备只需要一些 cookies 。

最佳答案

我大约2周前才更新到最新的FB sdk。这是我完成的方式:

//FB recommends to put these two in the app delegate in their sample apps but you can place them other places
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    NSArray *permissions = [NSArray arrayWithObjects:@"publish_actions", nil];
    return [FBSession openActiveSessionWithPermissions:permissions
                                          allowLoginUI:allowLoginUI
                                     completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
                                         NSLog((@"session.state is %d",session.state));
                                         if(session.state==513){
                                             [AppPrefererences sharedAppPrefererences].faceBookLoggedIn=YES;
                                             NSLog((@"facebookLogin pref has been set to yes from inside appDelegate"));
                                         }
                                         else{
                                             [AppPrefererences sharedAppPrefererences].faceBookLoggedIn=NO;
                                         }
                                     }];
}

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation {
    // FBSample logic
    // We need to handle URLs by passing them to FBSession in order for SSO authentication
    // to work.
    return [FBSession.activeSession handleOpenURL:url];
}


    //Then whereever you want to initiate the log in (i use mine in a tableView)
      AppDelegate  *appDelegate =(AppDelegate*) [[UIApplication sharedApplication]delegate];

 if (![appDelegate openSessionWithAllowLoginUI:NO]) {
                    [appDelegate openSessionWithAllowLoginUI:YES];
                    facebookLoginLabel.text=@"Facebook Log Out";
                    [AppPrefererences sharedAppPrefererences].faceBookEnabled=YES;
                }
                else{
                    facebookLoginLabel.text=@"Facebook Log In";
                    [AppPrefererences sharedAppPrefererences].faceBookLoggedIn=NO;
                    [FBSession.activeSession closeAndClearTokenInformation];                    
                }

然后,无论您要发布到哪里,都可以这样做:
  [FBRequestConnection startForPostStatusUpdate:@"any thing you want to post"
                                    completionHandler:^(FBRequestConnection *connection, id result, NSError *error){}];

而且,也不要忘记设置FBLoginViewDelegate

如果您有任何疑问,请告诉我!希望能帮助到你!

关于ios - Xcode Facebook登录错误已关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12432983/

相关文章:

ios - 在 ARKIT 中的 SceneKit 中的 3D 对象中的节点内找到一个点击的 childNode

iphone - 将 iphone 应用程序转换为 iPad、iOS?

ios - 我可以这样使用 PhoneGap 吗?

swift - 如何使用委托(delegate)模式将对象传输到另一个 VC?

ios - 如何调整导航栏中按钮的垂直位置?

facebook - FB.login() 弹出窗口仅在移动网络应用程序中被阻止

ios - 如何妥善处理所有潜在的网络错误?

Objective-C – iOS 4 到 iOS 5 应用程序启动方式的区别?

android - 在 android 中安装 facebook 应用程序时出现 Facebook 登录问题

Facebook iframe 中的 jQuery 无法在 IE 中加载