What is the best approach to handle syncing when the user can choose to enable or disable syncing whenever he wants?
Specifically I am currently having the problem that Simperium crashes after its instance have been deallocated. Consider the following scenario:
App now crashes with:
-[__NSCFString objectsShouldSync]: unrecognized selector sent to instance
where __NSCFString is some former object that already got released
I am using the current master branch.
This is a common request, and the "iosupdate" branch has some changes that will help. You can see this GitHub issue for some guidance. To summarize (quoting the author of this question):
When initializing the simperium instance set the following properties:
self.simperium.authenticationOptional = YES;
This make a cancel button appear.
self.simperium.authenticationEnabled = NO;
This prevents the authentication dialog from popping up.
self.simperium.loginViewControllerClass = [LoginViewController class]; This drops in a custom subclass of SPLoginViewController to overwrite the cancel: message, otherwise you would not get feedback that the user canceled the dialog.
When the user hits a sign "Sign in" button, I set
self.simperium.authenticationEnabled = YES;
which causes the login controller to show up.