Reputation: 3089
In my app, i allow users to see all their dropbox files, and they can import files into dropbox or download them into the app. I have looked on Dropbox's site but I couldn't find anything on canceling the upload/download. I have some apps (e.g. Textastic) that cancel the dropbox box file transfer, how can i cancel it so it deletes the downloaded data and stops loading into the app?
The code i use to load the file into the app is:
- (void)startDownloadingDropboxFile:(NSString *)dropboxFilePath toPath:(NSString *)destinationPath {
NSLog(@"dropbox file path: %@",dropboxFilePath);
NSLog(@"destination path: %@",destinationPath);
self.dbFilePath = dropboxFilePath;
[[self restClient] loadFile:dropboxFilePath intoPath:destinationPath];
}
Upvotes: 1
Views: 1297
Reputation: 318854
To cancel loadFile:
you need to call:
[[self restClient] cancelFileLoad:dropboxFilePath];
Obviously you need to hook this to some user interface button or other mechanism that allows the user to cancel the download.
This method takes care of cleaning up the partially downloaded file.
Upvotes: 2