itunes文件共享恢复已删除的文件

时间:2015-05-12 04:08:31

标签: ios itunes fileshare

我的应用使用iTunes文件共享。我用代码删除了一个文件: 它第一次工作。然而,在第二次尝试时,iTunes显示了一个空的共享目录。事实证明,所有数据文件都已消失。我可以从iPad恢复这些数据文件吗?感谢

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

1 个答案:

答案 0 :(得分:0)

iPad上没有“恢复”功能。但很可能没有什么可担心的。

您的代码无法删除多个文件。它将仅从您提供名称为fileName的Documents目录中删除该文件。如果您没有多次拨打deleteFileFromDisk:,则表示您没有删除多个文件。

也许在某些时候你删除了应用程序。这会删除整个沙箱,因此会在Documents目录中使用它。在重复测试期间,这种事情是完全正常的。

相关问题