简体   繁体   English

facebook-unity-sdk无法在iOS上工作(facebook-unity-sdk)

[英]facebook-unity-sdk not working on iOS (facebook-unity-sdk)

I am using Unity Facebook SDK 5.1 and Unity version is 4.3.0. 我使用的是Unity Facebook SDK 5.1 ,Unity版本是4.3.0。 I am testing on iPhone 4 device which don't have facebook app installed. 我正在测试没有安装Facebook应用程序的iPhone 4设备。 I have integrated SDK inside my game. 我在我的游戏中集成了SDK。

When i try to login into facebook using my app first it opens the FB login page inside browser,after login it ask me for authorization when i press "Ok" it takes me to my app. 当我尝试首先使用我的应用程序登录facebook时,它会在浏览器中打开FB login页面,登录后它会询问我的授权,当我按“确定”时它会将我带到我的应用程序。 Inside LoginCallBack method i got the following response LoginCallBack方法中,我得到了以下响应

FBResult.Text =
{"is_logged_in":false,"user_id":"","access_token":"NOT_USED_ON_IOS_FACEBOOK","access_token_expires_at":"01/01/0001 00:00:00"} .

Many Thanks Sachet 非常感谢Sachet

Make sure that your URLSchemeSuffix in your Info.plist is correct (fb[appid]) and that the handleOpenURL call (in your generated XCode project) is making it back to facebook. 确保Info.plist中的URLSchemeSuffix正确(fb [appid])并且handleOpenURL调用(在您生成的XCode项目中)将其返回到Facebook。

I had the very same problem where another plugin was capturing the handleOpenURL call when i was returning from facebook after authorizing the app and it was preventing the handleOpenURL response from making it all the way back to the facebook plugin. 我有同样的问题,当我在授权应用程序后从facebook返回时,另一个插件正在捕获handleOpenURL调用,并且它阻止了handleOpenURL响应使其一直回到facebook插件。

You can test it by putting a breakpoint in the Facebook/FbUnityInterface.mm file @ 您可以通过在Facebook / FbUnityInterface.mm文件中放置一个断点来测试它@

- (BOOL)openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication

If this isn't being hit, it's likely another openURL handler is getting the response first and not handing it back to super. 如果没有被击中,可能是另一个openURL处理程序首先获得响应而不是将其交给super。

I got the same error but for different reasons using iOS native login. 我得到了相同的错误,但出于不同的原因使用iOS本机登录。

I checked the URLScheme, add some breakpoints in the different OpenUrl but got nothing. 我检查了URLScheme,在不同的OpenUrl中添加了一些断点但什么都没有。 Turns out I was logging with the "publish_actions" permissions. 事实证明我正在使用"publish_actions"权限进行记录。 The message meant that this was not supported by iOS native implementation I suppose. 该消息意味着我认为iOS本机实现不支持这一点。

I regret the message not being helpful but you should pay attention to the requested permissions at login and ask them later using the graph API. 我很遗憾该消息没有帮助,但您应该在登录时注意所请求的权限,并在以后使用图形API询问它们。

Hope that will help people having the same issue. 希望能帮助人们解决同样的问题。

I got the same error. 我得到了同样的错误。 Reason was in incorrect bundle id (we used different bundle ids for release and development builds). Reason是不正确的bundle id(我们使用不同的bundle id进行发布和开发构建)。 Then we added this bundle id to Facebook App's Settings page, and the error gone. 然后我们将此捆绑包ID添加到Facebook App的“设置”页面,错误消失了。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM