iossimperium

How to prevent Simperium for authorizing automatically?


I want to allow my new users to play with the app a bit before I prompt them to create a Simperium account. How can I control authorization?

I used to be able to call:

self.simperium.authenticationEnabled = NO;

until I wanted Simperium to prompt the user to sign in, at which point I'd call:

simperium.authenticationEnabled = YES; [simperium authenticateIfNecessary];

Alas, authenticationEnabled doesn't seem to be available anymore. I'm currently using the develop branch.

Thanks!


Solution

  • In the new api, you can simply do as follows:

    1. Initialize Simperium (which, in turn, wires your Core Data stack):

      self.simperium = [[Simperium alloc] initWithModel:self.managedObjectModel context:self.managedObjectContext coordinator:self.persistentStoreCoordinator];

    2. Once you're ready to enable sync'ing (and thus, authenticate the user):

      [_simperium authenticateWithAppID:@"{SIMPERIUM_APP_ID}" APIKey:@"{SIMPERIUM_APP_KEY}" rootViewController:_window.rootViewController];

    (No need to flip the authenticationEnabled flag anymore!) Hope that helps!