-1

My app uses iTunes File Share. I used the code to delete a single file: It worked the first time. On the second try, however, iTunes showed a empty share directory. It turns out all data files are gone. Can I recover those data files from the iPad? Thanks

- (void) deleteFileFromDisk: (NSString*) fileName {
  if([self fileExists: fileName])  {
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) ;
        NSString *documentsDirectory = [paths objectAtIndex: 0];
        NSString* theFile = [documentsDirectory stringByAppendingPathComponent: fileName];
        NSError *error;
        [[NSFileManager defaultManager] removeItemAtPath: theFile error: &error];
Zac
  • 21
  • 6

1 Answers1

0

There's no "restore" feature on the iPad. But in all probability there's nothing to worry about.

There's nothing about your code that would delete multiple files. It would delete just that file from the Documents directory that you supplied the name of as fileName. If you didn't call deleteFileFromDisk: multiple times, you didn't delete multiple files.

Perhaps at some point you deleted the app. That would delete its entire sandbox and thus would take with it anything in the Documents directory. That sort of thing is perfectly normal during repeated testing.

matt
  • 515,959
  • 87
  • 875
  • 1,141