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:

  1. start app, login fb
  2. close app
  3. 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:

  1. add - (id)init:

    [[fbsdkapplicationdelegate sharedinstance] application:[uiapplication sharedapplication] didfinishlaunchingwithoptions:null]; 
  2. 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

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -