I'm working with Unity 4.6 and Facebook Unity SDK 6.0.
On Android things appear swell, but on iOS I don't seem to be utilizing the native 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.
And I've gone through the following checklist:
I've tried with both developer, admin and "stranger" accounts, and not a single one could get the native iOS facebook login.
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
.
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.
There are a few more FBSessionLoginType
behaviors, described in FBSession.h
which could be found in the FacebookSDK as well:
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;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.