Namratha
Namratha

Reputation: 16790

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];     
} 

Upvotes: 0

Views: 1003

Answers (2)

Namratha
Namratha

Reputation: 16790

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

Upvotes: 1

Claus Broch
Claus Broch

Reputation: 9212

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];

Upvotes: 1

Related Questions