【问题标题】:Dropbox API check if file is updatedDropbox API 检查文件是否更新
【发布时间】:2013-03-10 04:25:35
【问题描述】:

我正在寻找某种方法来检查文件何时在 Dropbox 上更新以告知用户。我发现的最好的代码是属于 Sync API 的代码 sn-p,它会观察是否有任何变化:

// First, create a file for you to change
DBPath *path = [[DBPath root] childPath:@"change-me.txt"];
self.file = [[DBFilesystem sharedFilesystem] createFile:path error:nil];

// Next, register for changes on that file
[self.file addObserver:self block:^() {

// This block will be called every time your file changes

// if newerStatus is not nil, it means a newer version is available
DBFileStatus *newerStatus = file.newerStatus;
if (newerStatus) {

if (!newerStatus.cached) {
NSLog(@"newerStatus.cached == NO; this means the file downloading");
} else {

// Update to the newly available version and print it out
[file update:nil];
NSLog(@"The file is done downloading: %@", [file readString:nil]);
}
}
}];

有什么想法吗?我实际上是想添加 Sync api 只是为了使用此功能,但我不认为添加两个 Dropbox SDK 是正确的解决方案。

【问题讨论】:

  • 我认为没有其他简单的方法可以做到这一点,而不使用 Sync Api..

标签: ios xcode dropbox


【解决方案1】:

我建议使用 Sync API,我们正在努力确保 Core API 的大部分功能都可以使用 Sync API。否则,您可以使用 REST API 的 /delta endpoint,它实际上为 Sync API 提供动力。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多