Search code examples
oauthaccess-tokenfacebook-ios-sdk

Facebook SDK: How to correct initialize FBSessionTokenCachingStrategy with old token?


How to correct initialize FBSessionTokenCachingStrategy?

I have: facebook-ios-sdk (not new, but 3.0).

Also, i have an iOS-project, thtat must run under iOS 5.*

And i have a trouble:

How to correct initialize session, if it must be reopen (not open)?

I have a token from last session and i want to login with this token.

But for this i need to create a FBSessionTokenCachingStrategy instance.

How to do this?

Thanks for help!


Solution

  • As i said before, i need this to create session and open it.

    Let's see, what i want:

    1. load TOKEN from my server. (and misc info about user).
    2. create session
    3. open session

    NOTE:

    It can be, that FBSessionTokenCachingStrategy instance was not saved on device.

    And i need to create it.

    And this is my algorithm: (code will be posted later)

    1. load TOKEN, expirationDate, userID from my server.
    2. create FBSessionTokenCachingStrategy instance manually, input in it's settings dictionary all fields, loaded in first step and(!) PERMISSIONS (it predefined in my app).
    3. init session.
    4. open session.

    Success!