简体   繁体   English

Unity Facebook SDK-iOS 8登录问题

[英]Unity Facebook SDK - iOS 8 Login Issues

I've had Facebook integrated in my Unity app, and I've been using it on my iPhone 5 with iOS 7 with no problem. 我已经在我的Unity应用程序中集成了Facebook,并且在没有iOS 7的iPhone 5上一直使用它。 But the problem comes when I try it on my friend's iPhone 6 running iOS 8. When I make a call to FB.Login() it switches to the Facebook app, as it normally should, but when it comes back to my app, Facebook opens the Webview for the Facebook login page with the error "You must log in to continue." 但是问题出在我在运行iOS 8的朋友的iPhone 6上尝试时。当我调用FB.Login()时,它会正常切换到Facebook应用程序,但是当它返回我的应用程序时,Facebook打开Facebook登录页面的Webview,错误为“您必须登录才能继续”。

The app registers that Facebook.IsLoggedIn is true, and the app continues as if it's logged in, but the Webview is still there and I have to close it to get back to my app. 该应用程序注册了Facebook.IsLoggedIn为true,并且该应用程序就像登录一样继续运行,但是Webview仍然存在,我必须关闭它才能返回我的应用程序。

The only real clue I have about what could be wrong is that the LoginCallback is being called twice in iOS 8 but not in iOS 7. 我唯一可能出问题的线索是,在iOS 8中两次调用了LoginCallback,但在iOS 7中没有两次。

Any relevant code is below, but it seems like the issue is coming from within the Facebook SDK itself. 任何相关代码在下面,但似乎问题出在Facebook SDK本身内。

public static readonly string FB_SCOPE = "email,public_profile,user_friends";

FB.Login(FB_SCOPE,FBLoginResult);

void FBLoginResult(FBResult result) {
    Debug.Log (result.Text);
}

Anyone have any idea, or experience anything similar? 任何人有任何想法,或经历过类似的事情吗?

I had the exact same problem. 我有同样的问题。 Turns out the FB.Login code was fired twice. 原来FB.Login代码被触发了两次。

I suggest you write a log near the FB.Login and make sure you don't see it twice. 我建议您在FB.Login附近写一个日志,并确保您没有两次看到它。

It seems that this is due to a bug in Unity3D specific to iOS 8. See here for details : http://fogbugz.unity3d.com/default.asp?692236_po26b9sb1uqlag7p 看来,这是由于iOS 3中特定于Unity3D的错误所致。有关详细信息,请参见此处: http : //fogbugz.unity3d.com/default.asp?692236_po26b9sb1uqlag7p

Here is a workaround to fix the problem in NGUI. 这是解决NGUI中问题的解决方法。 Go to UICamera.cs and add the following line of code in the function public void ProcessTouches () 转到UICamera.cs并在函数public void ProcessTouches ()添加以下代码行

MouseOrTouch touch = null;
if (input.phase == TouchPhase.Ended && !mTouches.TryGetValue(currentTouchID, out touch)) 
   return;

just after this : 在此之后:

for (int i = 0; i < Input.touchCount; ++i)
    {
        Touch input = Input.GetTouch(i);
        currentTouchID = allowMultiTouch ? input.fingerId : 1;

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

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