Xcode的Facebooklogin错误closures

嗨,我正在阅读和阅读http://developers.facebook.com/这里的教程。

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

而我无法得到它的工作。 它很烂,讨厌,没有关于这个的明确的教程/解释。

我试图从我的应用程序login,当Safari浏览器打开,然后url就像疯了闪烁..

而我没有得到一个错误,为什么?

有没有任何CLEAR教程关于login?

它在模拟器上工作很好,但不在设备上。

我在Xcode 4.5testing版现在,但它也不适用于4.4。

我需要帮助!

[closures]

编辑 :我修好了! 我太愚蠢了…我在七天的时间里只是为了login到FB而挣扎,然后我改变了( 设备上允许Cookies ),一切都很完美!

该死的设备只需要一些cookies..大声笑

大约两星期前我刚刚更新到最近的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

让我知道如果你有任何问题! 希望能帮助到你!