适用于Unity的Facebook SDK 3.1.2 - 在Android设备上登录失败 [英] Facebook SDK 3.1.2 for Unity - Trouble logging in on Android Devices

查看:226
本文介绍了适用于Unity的Facebook SDK 3.1.2 - 在Android设备上登录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Unity使用最新版本的SDK SDK 3.1.2版。我的问题有点类似于这个问题。不同之处在于我的iOS构建工作正常。而我的Android版本没有得到空引用。相反,我的Android构建将不会登录。

I'm using the latest version of the Facebook SDK, version 3.1.2, for Unity. My problem is somewhat similar to this question. The differences being that my iOS builds work just fine. And my Android builds aren't getting null references. Instead, My android build will just not log in.

当我点击我的登录按钮,它会弹出对话屏幕,让应用程序权限访问基本东西,公开的个人资料和朋友名单。碰到ok按钮后,它将返回到我的应用程序,但登录失败。我发现AndroidFacebook类,并注意到OnLoginComplete函数有一个字符串消息参数,它应该从中获取用户的id和访问令牌。所以我把一个调试信息放在那里看看是什么回来的。事实证明,虽然我按确定让应用程序访问Facebook,但是这个过程被取消了。 {cancelled:true}是返回的Json字符串。我在Facebook开发人员页面中检查了我的应用程序设置,打包名称,类名和调试哈希键都与Unity Facebook设置中的一致。我甚至尝试打开和关闭沙盒模式。

When I click my login button, it'll bring up the dialogue screen to give the app permission to access the basic stuff, public profile and friend list. Upon hitting the ok button, it'll return me to my app but fail the login. I found the AndroidFacebook class and noticed that OnLoginComplete function has a string message param where it should grab the user's id and access token from. So I put a debug message in there to see what was being returned. It turns out that although I press ok to give the app access to facebook, it's saying that the process was cancelled. {"cancelled":true} is the Json string being returned. I've doubled check my app settings in the facebook developer page and the Package name, class name and debug hash key all match what I have in the Unity Facebook settings. I've even tried with the Sandbox mode on and off.

推荐答案

这听起来像没有android键哈希正确设置在Unity编辑器中,单击主菜单栏上的Facebook条目,然后单击编辑设置。找到标有调试Android Key Hash的项目,并将该值复制到剪贴板。

It sounds like you don't have the android key hash set up correctly. In the Unity Editor, click the Facebook entry on the main menu bar, then click "Edit Settings". Find the item marked "Debug Android Key Hash" and copy the value to your clipboard.

导航到 http://apps.facebook.com ,找到你的应用程序。将您从编辑器中获取的密钥哈希粘贴到您的应用程序本机Android安装程序的钥匙哈希部分。此页有关于您的设置应如何查找的图片。

Navigate to http://apps.facebook.com and find you app. Paste the key hash you took from the editor into the "Key Hashes" section of your apps native android setup. This page has a picture of how your setup should end up looking.

这篇关于适用于Unity的Facebook SDK 3.1.2 - 在Android设备上登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆