简体   繁体   English

在设备上运行应用程序时,iOS Facebook SDK“用户取消登录”?

[英]iOS Facebook SDK “user cancelled login” when running app on device?

I'm using the latest iOS Facebook SDK and I can log in and out perfectly when I am running my app in the simulator (in which case it opens the non-native popup window because the facebook app is not installed), but when I run it on my device I get the native uialertview popup and when I click "ok", the terminal says "user cancelled login" and the popup dismisses but it doesn't log in. Do you have any idea what could be causing this? 我正在使用最新的iOS Facebook SDK,当我在模拟器中运行我的应用程序时,我可以完美地登录和退出(在这种情况下,它会打开非本机弹出窗口,因为未安装Facebook应用程序),但是当我在我的设备上运行它我得到了原生的uialertview弹出窗口,当我点击“确定”时,终端显示“用户取消登录”并且弹出窗口解除但它没有登录。你知道是什么原因造成这种情况吗? I have done some research and couldn't find anything. 我做了一些研究,找不到任何东西。 I have pretty much followed their example app "Scrumptious" to the letter and I can't figure out why it works for that app but not mine. 我几乎跟着他们的示例应用程序“Scrumptious”到这封信,我无法弄清楚为什么它适用于该应用程序而不是我的应用程序。

Apart from wrong bundle, not handling Facebook callback can be a reason too. 除了错误的捆绑,不处理Facebook回调也是一个原因。 Add below mentioned method in app delegate. 在app delegate中添加下面提到的方法。

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                      openURL:url
                                            sourceApplication:sourceApplication
                                                   annotation:annotation];
}

Try to add the bundle identifier of your app on developer.facebook.com where you have created your appID. 尝试在developer.facebook.com上添加应用程序的软件包标识符,您可以在其中创建appID。 And make sure that bundle identifier of your app and you have entered both are same.! 并确保您的应用程序的捆绑标识符和您输入的两者都是相同的。! Also in mobile settings check that you have access permissions to your app. 同样在移动设置中,检查您是否拥有对应用的访问权限。 Here you will have to add your bundle identifier and save the changes. 在这里,您必须添加包标识符并保存更改。

Hope it will work. 希望它会奏效。

If you have the Facebook App installed on the iPhone, make sure your application is allowed to connect using it. 如果您在iPhone上安装了Facebook App,请确保允许您的应用程序使用它进行连接。 Go to Settings > Facebook and make sure your app is enabled for Login. 转到设置> Facebook,确保您的应用已启用登录。

Besides the common problems with bundle_id and permission from Facebook app in Settings , I encountered another strange issue , after doing all that I could do , noticed I was getting the same problem "User cancelled login" . 除了bundle_id的常见问题和Settings Facebook app permission ,我遇到了另一个奇怪的问题,在做了我能做的所有事情之后,注意到我遇到了同样的问题"User cancelled login"

I went into Settings and checked under Facebook the account I was logged in with, then I deleted the account and left the one managed by the Facebook application , that worked, not sure why , but fixed my problem. 我进入Settings并在Facebook下检查我登录的帐户,然后我删除了帐户并离开了由Facebook application管理的帐户,这有效,不确定原因,但修复了我的问题。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Unity IOS的​​facebook api中的“被玩家取消登录”回调(仅当设备中具有facebook应用程序时) - “Login cancelled by player” callback in facebook api for Unity IOS (only if you have facebook app in device) 使用ios Facebook SDK登录时缺少“使用Facebook App登录” - Missing “Log In With The Facebook App” when using ios Facebook SDK login Facebook IOS SDK登录在模拟器上有效,而不在设备上有效 - Facebook IOS SDK Login works on simulator, not on device 安装Facebook应用程序的Facebook SDK iOS登录 - Facebook SDK iOS login with Facebook app installed Facebook iOS SDK用户配置文件登录属性 - Facebook iOS SDK User Profile Login Attributes 在 iOS 版 Facebook SDK 中登录不同的用户 - Login different user in Facebook SDK for iOS 用户取消IAP iOS SDK时如何更新UI - How to Update UI when user cancelled IAP ios sdk 使用Facebook iOS SDK进行身份验证并登录到我的应用 - Authentication and login to my app with Facebook iOS SDK Facebook SDK 3.1 iOS:如果用户从Facebook设置中删除应用,则处理登录 - Facebook SDK 3.1 iOS: Handle login if user remove app from Facebook Settings iOS SDK上的Facebook SDK份额返回份额被取消 - Facebook SDK share on iOS returns share was cancelled
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM