Facebook的统一SDK在Android上 - 登录FB装应用程序时出现故障 [英] Facebook Unity SDK on Android - Login fails when FB App installed

查看:134
本文介绍了Facebook的统一SDK在Android上 - 登录FB装应用程序时出现故障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎有在这个问题讨论了同样的问题: <一href="http://stackoverflow.com/questions/18959004/facebook-sdk-for-unity-on-android-trouble-about-callback-from-fb-login">Facebook SDK团结在Android上 - 故障有关回调从FB.Login

I appear to be having the same issue as discussed in this question: Facebook SDK for Unity on Android - Trouble about callback from FB.Login

在Android设备上安装常规的Facebook应用程序时,使用Unity SDK提示用户接受应用程序,当应用程序被批准回调烧制权限调用FB.Login(): FBResult.Text

On Android when the regular Facebook app is installed, calls to FB.Login() using the Unity SDK prompt the user to accept permissions for the app and when the app is approved the callback is fired with: FBResult.Text

{is_logged_in:假的,USER_ID:,access_token:}

FBResult.Error

FBResult.Error

在Facebook的应用程序被安装在Web流量的使用和工作得很好,我却试图与V4.2.4统一SDK和v4.2.2。

When the Facebook app is installed the web flow is used and works fine, I have however tried this with v4.2.4 and v4.2.2 of the Unity SDK.

在收到此决定的任何其他建议吗?

Any other advice on getting this resolved?

编辑:还应注意,我在2个不同的设备(Galaxy Note的10.1和Nexus 7)尝试过这种

Should also note, I've tried this on 2 different devices (Galaxy Note 10.1 and Nexus 7)

在此先感谢!

的说明2014年在某些情况下,这个问题是非常简单的,你已经忘记了上developers.facebook的设置。布莱恩解释在这里用图片:的http://answers.unity3d.com/questions/543540/facebook-sdk-v424-android-login-not-working.html令人困惑的是它会工作(!)设备上没有FB的应用程序,如果你已经完全忘记了设置。至于实际的问题,幸运的是有一个解决方案即使你在Mac上使用Unity,这是简单的:<一href="http://answers.unity3d.com/questions/609810/using-facebook-api-with-android-says-login-is-canc.html" rel="nofollow">http://answers.unity3d.com/questions/609810/using-facebook-api-with-android-says-login-is-canc.html

A note for 2014. In some cases the problem is very simply that you've forgotten the settings on developers.facebook. Brian explains it here with images: http://answers.unity3d.com/questions/543540/facebook-sdk-v424-android-login-not-working.html Confusingly it WILL WORK (!) on devices WITHOUT the fb app, if you have completely forgotten the settings. As to the actual problem, fortunately there is a solution even if you are using Unity on Mac and it is simple: http://answers.unity3d.com/questions/609810/using-facebook-api-with-android-says-login-is-canc.html

推荐答案

胆碱觉得太傻了,最终设法解决它自己,通过部署到中介谷歌Android项目,我能够使用的logcat获得更多有用的错误消息话题:

Ach feel so silly, eventually managed to solve it myself, by deploying to an intermediary Google Android Project, I was able to use logcat to obtain a more useful error messsage:

remote_app_id不匹配存储的ID

remote_app_id does not match stored id

从那里,我发现这个话题涉及到标准的Andr​​oid SDK: <一href="http://stackoverflow.com/questions/13894006/android-facebook-sdk-3-0-gives-remote-app-id-does-not-match-stored-id-while-lo">Android Facebook的SDK 3.0给出了&QUOT; remote_app_id不匹配存储的ID&QUOT;而在登录

From there I found this topic relating to the standard Android SDK: Android Facebook SDK 3.0 gives "remote_app_id does not match stored id" while logging in

和最后通过与该code段获得一个更换密钥散列解决了这个问题。

And finally solved the problem by replacing the Key Hash with the one obtained by this code snippet

try {
PackageInfo info = getPackageManager().getPackageInfo(
      "com.facebook.samples.loginhowto", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures){
       MessageDigest md = MessageDigest.getInstance("SHA");
       md.update(signature.toByteArray());
       Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}

当然是有自己的包名更换com.facebook.samples.loginhowto

来源: <一href="http://stackoverflow.com/a/14421260/2823496">http://stackoverflow.com/a/14421260/2823496

这似乎得到正确的keyhash,通过命令行或通过统一取决于有正确版本的OpenSSL安装(并存储在PATH中),但不知道是什么版本的。 (试过一个在连接答案)于是抬起头,给任何人使用此苦苦挣扎。

It seems getting the correct keyhash, via command line or through Unity depends on having the right version of openssl installed (and stored in PATH) but no idea what version that is. (tried the one in linked answer) So heads up to anyone else struggling with this.

请注意 - 这几乎是不可能的,如果你使用的是Mac的团结发展,做到这一点。下面是在这种情况下,<一个所幸简单的解决方案href="http://answers.unity3d.com/questions/609810/using-facebook-api-with-android-says-login-is-canc.html" rel="nofollow">http://answers.unity3d.com/questions/609810/using-facebook-api-with-android-says-login-is-canc.html

Note - it's almost impossible to do this if you're using Mac for Unity development. Here's the fortunately simple solution in that case http://answers.unity3d.com/questions/609810/using-facebook-api-with-android-says-login-is-canc.html

这篇关于Facebook的统一SDK在Android上 - 登录FB装应用程序时出现故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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