0
我正在搜索某種方法以檢查Dropbox上的文件何時更新以通知用戶。我找到的最好的是一個代碼段屬於同步API,如果有任何變化,這指出:Dropbox API檢查文件是否已更新
// 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 .. – Bala 2013-03-08 07:31:38