unity3d - facebook unity sdk 7.0.2 - FB.IsLoggedIn returns false when you reopen the app but should still be logged in -
prior upgrading 7.x version of unity fb sdk, fb.isloggedin return true after fb.init. now, returning false , have new login every time.
this seems bug.
i'm on unity 5.1.1p4 , building android. haven't tried ios yet.
reproduction steps:
- start app, login fb
- close app
- start app again, not automatically logged in fb (fb.isloggedin false)
expected behavior:
fb.isloggedin should true if logged in. how worked before.
in fbunityinterface.mm
:
add -
(id)init
:[[fbsdkapplicationdelegate sharedinstance] application:[uiapplication sharedapplication] didfinishlaunchingwithoptions:null];
replace in -
(void)configureappid
:[fbunityutility sendmessagetounity:fbunitymessagename_oninitcomplete userdata:@{} requestid:0];
with:
if ([fbsdkaccesstoken currentaccesstoken]) { fbsdkaccesstoken *token = [fbsdkaccesstoken currentaccesstoken]; nsinteger expiration = token.expirationdate.timeintervalsince1970; [fbunityutility sendmessagetounity:fbunitymessagename_oninitcomplete userdata:@{ @"opened" : @"true", @"access_token" : [fbsdkaccesstoken currentaccesstoken].tokenstring, @"expiration_timestamp" : [@(expiration) stringvalue], @"user_id" : [fbsdkaccesstoken currentaccesstoken].userid, @"permissions" : [token.permissions allobjects], } requestid:0]; return; } else { [fbunityutility senderrortounity:fbunitymessagename_oninitcomplete errormessage:@"unknown login error" requestid:0]; }
Comments
Post a Comment