开发者

Change Doesn't Persist

I've been working with the 开发者_Go百科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?


Yes:

[[NSUserDefaults standardUserDefaults] synchronize];


[[NSUserDefaults standardDefaults] synchronize];

From memory, so check the syntax.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜