I'm using Dropbox to sync files in my app. When try to unlink account to Dropbox, with below statement:
[[[DBAccountManager sharedManager] linkedAccount] unlink];
iPhone 4S takes around 1 sec, simulator a little big longer,3GS quite long, however for iPhone 5 it looks like its not working at all!. Could this be a memory issue? Am I missing something here?
Appreciate your advice!
Ethan
from the dropbox forum . The unlinking does finish only after syncinc/downloading is complete.
Using GCD works for me.
- (void)dropboxLogout {
self.isLogingOut = YES;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
[[[DBAccountManager sharedManager] linkedAccount] unlink];
self.isLogingOut = NO;
});
}
i use the isLogingOut
flag to prevent my app from further communicating with the dropbox api while unlinking is in progress.
I use this code based on latest dropbox SDK:
- (IBAction)unlinkDropbox:(UIButton *)sender {
DBAccount *account = [[DBAccountManager sharedManager] linkedAccount];
if (account) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
[account unlink];
// Shutdown and stop listening for changes to the datastores
[[DBDatastoreManager sharedManager] shutDown];
[[DBDatastoreManager sharedManager] removeObserver:self];
// Use local datastores
[DBDatastoreManager setSharedManager:[DBDatastoreManager localManagerForAccountManager:[DBAccountManager sharedManager]]];
});
self.isLinked = NO;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.