简体   繁体   中英

Cannot delete files from Dropbox(from iPhone app)

I'm trying to delete files from my dropbox. I have implemented the swipe delete behaviour. This 'swipe-delete' deletes the files from the tableView only. Next time I upload, I can see the 'deleted' files back and also when I check my dropbox account on my PC, those files never get deleted. They're always there even immediately after the file disappears from the tableView.

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView   editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath  {    
      return UITableViewCellEditingStyleDelete;
  }

- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath :(NSIndexPath *)indexPath  {                
    [self.itemArray  removeObjectAtIndex:indexPath.row];        

    [aTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];

    [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0]withRowAnimation:UITableViewRowAnimationFade];     
} 

You're code only shows you're deleting the entry from the table view. There is no code that actually deletes from the file system, eg. by using

[[NSFileManager defaultManager] removeItemAtPath:filepath error:&error];

The above discussion(NSFileManager) removes files only from the device. For deleting files on dropbox, we must use deleteFilePath and deletePathFailedWithError.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM