1

I am trying to delete a file in the main bundle of my app in code. What I am trying is: get the file path via [[NSBundle mainBundle] pathForResource:ofType:], then try to delete it via [[NSFileManager defaultManager] removeItemAtPath:].

My problem is, my app is sandboxed, so I got information like this: sandboxd deny file-write-unlink ...

Is there a way to overcome this? Any idea would be appreciated.

4

1 回答 1

1

您不能删除自己沙箱中的文件,因为它会破坏用于验证您的应用程序有效性的数字签名。

如果你想拥有可以以这种方式操作的文件,那么你需要将它们从你的包中复制到缓存目录中,你可以在其中对它们做任何你喜欢的事情。

于 2012-07-31T09:29:07.943 回答