Search code examples
ioscopynsfilemanager

iOS NSFileManager - delete file from main app bundle


In my app people can download some audio-lessons from my server. After a file is saved i move it to app's document directory. Now i want my app to have the first file downloaded with the app, so user have one lesson out of the box. I've added that file to main app directory (from xcode), and at the app startup i copy it to app's document directory. That all works fine, and now the problem: when i try to delete the copy of my audio file from main app directory i get the following error "The operation couldn’t be completed. Operation not permitted". How that can be solved?


Solution

  • The task you are trying to achieve is not possible with iOS or any hacks that I know of. Even if it were, your app would be rejected by Apple since they do not allow an app to change contents of the main bundle in an app directory.