Question

I've been working with the Dropbox API as of late, and have run into an infuriating but interesting snag. The SDK saves OAuth tokens in standardUserDefaults, and if the user wants to disable the Dropbox functionality the OAuth tokens have to be removed (otherwise the SDK finds them and goes off to work).

Here's the weird part: whether I use the SDK method [[DBSession sharedSession] unlink] or simply a [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"kDBDropboxSavedCredentialsKey"] (which is actually part of the method, the change does not persist across app launches. The key is deleted for the duration of the current session, but it regenerates when the app is launched again. Am I missing something?

Was it helpful?

Solution

Yes:

[[NSUserDefaults standardUserDefaults] synchronize];

OTHER TIPS

[[NSUserDefaults standardDefaults] synchronize];

From memory, so check the syntax.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top