Search code examples
facebooktvosfbsdk

Should the FBSDKAccessToken automatically cache on tvOS


After I perform a successful authentication (using FBSDKDeviceLoginViewController) in my app, I have an access token but that disappears the next time I run the app from fresh.

I'm using FBSDKTVOSKit v4.10.1 and testing via the simulator (so potentially this could be the problem) but, I want to confirm my assumption that it's the SDK's responsibility to persist and reinstate the token and not the developers?

Is this an issue with the version of the SDK I'm using and/or the simulator or is the assumption that the user will have to authenticate each time?


Solution

  • The SDK will cache the token. Did you make sure you followed step 6 of the Getting Started Guide and connected your application delegate to the SDK? That's how the SDK will restore the token when available;

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      [[FBSDKApplicationDelegate sharedInstance] application:application
        didFinishLaunchingWithOptions:launchOptions];
      // Add any custom logic here.
      return YES;
    }