views:

36

answers:

2

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?

+3  A: 

Yes:

[[NSUserDefaults standardUserDefaults] synchronize];
Rits
Thanks. I wonder why the SDK method doesn't have that built into it? ಠ_ಠ
redwall_hp
+1  A: 

[[NSUserDefaults standardDefaults] synchronize];

From memory, so check the syntax.

Jordan
It's [[NSUserDefaults standardUserDefaults] synchronize], and that worked. Thanks.
redwall_hp