[英]Facebook Unity SDK on Android crashes when fb.init is called
I'm working facebook unity SDK, everything is fine on unity editor, but doesn't work on android device. 我正在使用facebook unity SDK,在unity editor上一切正常,但在android设备上不起作用。 "App stopped" when fb.init called.
调用fb.init时“应用已停止”。
I use unity 5.5.1 version and facebook sdk version is 7.9.4 我使用统一5.5.1版本,facebook sdk版本为7.9.4
here is code : 这是代码:
public void teststr()
{
if (!FB.IsInitialized) {
// Initialize the Facebook SDK
FB.Init(InitCallback, OnHideUnity);
} else {
// Already initialized, signal an app activation App Event
}
}
private void InitCallback ()
{
if (FB.IsInitialized) {
// ...
} else {
}
}
private void OnHideUnity (bool isGameShown)
{
if (!isGameShown) {
// Pause the game - we will need to hide
Time.timeScale = 0;
} else {
// Resume the game - we're getting focus again
Time.timeScale = 1;
}
}
teststr function fires when I clicked button 单击按钮时将触发teststr函数
I've solved! 我解决了!
I use FB.Init(this.InitCallback, this.OnHideUnity);
我使用
FB.Init(this.InitCallback, this.OnHideUnity);
instead of FB.Init(InitCallback, OnHideUnity);
而不是
FB.Init(InitCallback, OnHideUnity);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.