简体   繁体   English

Facebook-unity-SDK不使用iOS本机SSO

[英]Facebook-unity-sdk not using iOS native SSO

I'm working with Unity 4.6 and Facebook Unity SDK 6.0. 我正在使用Unity 4.6和Facebook Unity SDK 6.0。

On Android things appear swell, but on iOS I don't seem to be utilizing the native Facebook SSO. 在Android上,事情似乎膨胀了,但是在iOS上,我似乎并没有利用原生的Facebook SSO。 It constantly reverts to the browser-based login, which really gives off a unprofessional vibe. 它会不断恢复为基于浏览器的登录,这确实散发出不专业的氛围。

I've tested this on ten different devices, all using both Developer certificates. 我已经在十个不同的设备上进行了测试,都使用了两个Developer证书。

And I've gone through the following checklist: 我已经检查了以下清单:

  • XCode on running recieves no errors or logs that should indicate anything wrong, yet still uses the old "browserbased" login solution. 运行时的XCode不会显示任何错误或日志,该错误或日志应指示任何错误,但仍使用旧的“基于浏览器”的登录解决方案。
  • This also applies when i use the example scene contained in the SDK. 当我使用SDK中包含的示例场景时,这也适用。
  • The app is enabled for SSO in Facebook Developer console, and the bundle IDs match. 该应用程序已在Facebook Developer Console中启用了SSO,并且捆绑包ID匹配。
  • The FBXXXXXXXXX URL sceme is in the info.plist and appears just fine in XCode. FBXXXXXXXXX URL sceme在info.plist中,并且在XCode中看起来很好。
  • The FacebookAppID key in the info.pList is also set, and uses the numerical facebook app id. info.pList中的FacebookAppID密钥也已设置,并使用数字Facebook应用程序ID。
  • In facebook, the app is open to the general public, has the contact email required, and the iOS bundle is configured. 在Facebook中,该应用程序对公众开放,需要联系人电子邮件,并且已配置iOS捆绑包。

I've tried with both developer, admin and "stranger" accounts, and not a single one could get the native iOS facebook login. 我已经尝试使用开发者帐户,管理员帐户和“陌生人”帐户,但没有一个帐户可以获取本机iOS Facebook登录。

Have anyone met this ? 有人遇到过这个吗? Most similar cases I could find are over a year old and does not really apply to this. 我发现的大多数类似案例都已经有一年多的历史了,并不真正适用于此。

To get native facebook login on iOS, locate the file FbUnityInterface.mm (Assets/Facebook/Editor/iOS) and find the method -(void)login:(const char *)scope . 要在iOS上获取本地Facebook登录,请找到文件FbUnityInterface.mm (Assets / Facebook / Editor / iOS)并找到-(void)login:(const char *)scope

In this method replace: 用这种方法替换:

[self.session openWithBehavior:FBSessionLoginBehaviorWithFallbackToWebView]

with this: 有了这个:

[self.session openWithBehavior:FBSessionLoginBehaviorUseSystemAccountIfPresent]

Facebook Unity SDK by defaults doesn't use native iOS logging behavior, which is kind of strange. 默认情况下,Facebook Unity SDK不使用本机iOS日志记录行为,这有点奇怪。

There are a few more FBSessionLoginType behaviors, described in FBSession.h which could be found in the FacebookSDK as well: 还有更多FBSessionLoginType行为,在FBSession.h中描述,也可以在FacebookSDK中找到:

typedef enum {
    /*! Attempt Facebook Login, ask user for credentials if necessary */
    FBSessionLoginBehaviorWithFallbackToWebView      = 0,
    /*! Attempt Facebook Login, no direct request for credentials will be made */
    FBSessionLoginBehaviorWithNoFallbackToWebView    = 1,
    /*! Only attempt WebView Login; ask user for credentials */
    FBSessionLoginBehaviorForcingWebView             = 2,
    /*! Attempt Facebook Login, prefering system account and falling back to fast app switch if necessary */
    FBSessionLoginBehaviorUseSystemAccountIfPresent  = 3,
    /*! Attempt only to login with Safari */
    FBSessionLoginBehaviorForcingSafari = 4,
} FBSessionLoginBehavior;

In Facebook SDK 7.2 change shareDialogMode in Unity itself in MobileFacebook.cs 在Facebook SDK 7.2中,在MobileFacebook.cs中更改Unity本身中的shareDialogMode 在此处输入图片说明

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

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