简体   繁体   中英

is possible Remove file from main bundle?

I have created a sqlite file and added it into the mainBundle of my Xcode project. This file gets copied to document directory from main bundle on app launch. Is there a possibility to remove the file from my mainBundle after i copied it to the document directory ?

From within an official application, you can't - the app bundle is read-only.

If you are running on a jailbroken device and you manage to give root access to your executable, then you can.

Is is impossible. What's more, if you copy too much data from main bundle to document directory, you may be rejected by app store because iCloud will backup the data in document directory. I have ever been rejected for this reason. You can copy the data to cached directory instead.

Basically in an app you developed a logic that on run time you need to delete some resource from NSBundle time(which is through coding).As initailly the application is run on simulator by most developers.it will work perfectly with no issue.

But when you run the same application on device ie iPhone/iPad it will show a error i,e NSCocoaErrorDomain = 513.

What it means is that on runtime in device the bundle has only read permisson not write. So when designing the applications do not include logic that deletes the resource from NSBundle on run time because it will work perfectly in iPhone/iPad simulator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM