Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在iOS Dropbox Sync API 3.0中打开数据存储_Ios_Dropbox Api - Fatal编程技术网

在iOS Dropbox Sync API 3.0中打开数据存储

在iOS Dropbox Sync API 3.0中打开数据存储,ios,dropbox-api,Ios,Dropbox Api,3.0数据存储API的一个新功能是能够使用本地数据存储,当用户决定将应用程序链接到Dropbox时,这些本地数据存储将与Dropbox同步。我想知道现在打开数据存储的过程有什么不同 例如,这就是我当前打开数据存储的方式: DBAccount *account = [[DBAccountManager sharedManager] linkedAccount]; self.store = [DBDatastore openDefaultStoreForAccount:account error:n

3.0数据存储API的一个新功能是能够使用本地数据存储,当用户决定将应用程序链接到Dropbox时,这些本地数据存储将与Dropbox同步。我想知道现在打开数据存储的过程有什么不同

例如,这就是我当前打开数据存储的方式:

DBAccount *account = [[DBAccountManager sharedManager] linkedAccount];
self.store = [DBDatastore openDefaultStoreForAccount:account error:nil];
如果没有链接帐户,如何获取DBAccount?也许我不知道:

同样,如果没有帐户,使用openDefaultStoreForAccount打开数据存储的过程是什么

我刚刚注意到openDefaultLocalStoreForAccountManager:

是这样用的吗?当有链接帐户时,这是否仍然有效

self.store = [DBDatastore openDefaultLocalStoreForAccountManager:[DBAccountManager sharedManager] error:nil];
我非常感谢你的帮助。谢谢

来自:


你看到了吗?这回答了你的问题吗?另一个问题。如果用户从Dropbox取消应用程序链接,我是否需要恢复本地数据存储?如果API能够自动管理链接状态和未链接状态之间的来回,那就太酷了。我相信迁移是一次性和单向的。如果用户取消了应用程序的链接,数据存储的本地缓存将被删除。酷,有道理。谢谢你的帮助!
// If the user has linked a Dropbox account for the first time...
if (_justLinked) {
    if (_localDatastoreManager && self.account) {
        // Perform a one-time migration to move from the local datastore to a remote one.
        [_localDatastoreManager migrateToAccount:self.account error:nil];
        _localDatastoreManager = nil;
    }
}
if (!_store) {
    // If there's a linked account, use that.
    if ([[DBAccountManager sharedManager] linkedAccount]) {
        _store = [DBDatastore openDefaultStoreForAccount:self.account error:nil];
    // Otherwise, use a local datastore.
    } else {
        _store = [DBDatastore openDefaultLocalStoreForAccountManager:[DBAccountManager sharedManager]
                                                               error:nil];
    }
}