No se pudo eliminar el archivo en el paquete principal en la zona de pruebas

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.

preguntado el 31 de julio de 12 a las 10:07

1 Respuestas

You cannot delete files in your own sandbox as for one thing it will break the digital signature used to verify the validity of your app.

If you want to have files that can be manipulated in this way then you need to copy them from your bundle into, say, the caches directory, where you can do whatever you like to them.

Respondido 31 Jul 12, 10:07

this seems convincing, but preventing me from implementing my idea. - Terry

I want a file can only used once in the bundle. - Terry

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.