我正在使用 Parse 和 LogInViewController。我在登录 View 中添加了 Facebook。
当有人想连接 Facebook 时,它会打开浏览器,用户接受应用程序,然后返回应用程序。但当他返回应用程序时,他仍处于“加载”状态,但什么也没有发生。
但是,如果用户重新启动应用程序,它就可以工作。
只有当它是用户的第一个连接时我才会遇到这个问题。
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (![PFUser currentUser]) {
// Customize the Log In View Controller
PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
[logInViewController setDelegate:self];
[logInViewController setFacebookPermissions:[NSArray arrayWithObjects:@"friends_about_me", nil]];
[logInViewController setFields: PFLogInFieldsFacebook | PFLogInFieldsDismissButton];
// Present Log In View Controller
[self presentViewController:logInViewController animated:YES completion:NULL];
}
}
我认为问题不在我的代码中,因为我使用的是 Parse 的默认代码,但我不确定。
最佳答案
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
withSession:[PFFacebookUtils session]];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
[FBAppCall handleDidBecomeActiveWithSession:[PFFacebookUtils session]];
}
- (void)applicationWillTerminate:(UIApplication *)application {
/*
Called when the application is about to terminate.
Save data if appropriate.
See also applicationDidEnterBackground:.
*/
[[PFFacebookUtils session] close];
}
关于facebook - Parse.com Facebook 登录停留在 "Loading"iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25418476/