試試這個
/*恢復在路徑的文件,因爲它的存在,在給定的轉速和恢復後返回恢復 文件的元數據*/
- (void)restoreFile:(NSString *)path toRev:(NSString *)rev;
其中path是必須恢復的DropBox文件的路徑,rev是要修復的修訂版本
和它小號委託方法是
- (void)restClient:(DBRestClient*)client restoredFile:(DBMetadata *)fileMetadata;
- (void)restClient:(DBRestClient*)client restoreFileFailedWithError:(NSError *)error;
,您可以用這些來獲取特定文件的修訂列表
/*加載在路徑較過去文件的修訂,直到10 DBMetadata對象的列表*/
- (void)loadRevisionsForFile:(NSString *)path;
/*同上,但具有可配置限制DBMetadata對象的數目返回,高達1000 */
- (void)loadRevisionsForFile:(NSString *)path limit:(NSInteger)limit;
及其委託的方法是
- (void)restClient:(DBRestClient*)client loadedRevisions:(NSArray *)revisions forFile:(NSString *)path;
- (void)restClient:(DBRestClient*)client loadRevisionsFailedWithError:(NSError *)error;
例如
NSString *filePath = @"/Contacts";
NSString *revisionStr = @"a1067dc176"; // sample revisionString
[[self restClient] loadRevisionsForFile:filePath limit:10];
[[self restClient] restoreFile:filePath toRev:revisionStr];
//委託方法
- (void)restClient:(DBRestClient*)client loadedRevisions:(NSArray *)revisions forFile:(NSString *)path{
for (DBMetadata *file in revisions)
{
NSLog(@"MetaData's Revisions \t%@", file.rev);
}
}
- (void)restClient:(DBRestClient*)client loadRevisionsFailedWithError:(NSError *)error{
}
- (void)restClient:(DBRestClient*)client restoredFile:(DBMetadata *)fileMetadata{
NSLog(@"Restored FileMetaData Path : %@",fileMetadata.path);
NSLog(@"Restored FileMetaData rev : %@",fileMetadata.rev);
}
- (void)restClient:(DBRestClient*)client restoreFileFailedWithError:(NSError *)error{
NSLog(@"There was an error restoring the file - %@", error);
}