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];
}
To cancel
loadFile:you need to call: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.