Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete file from bundle after install

I realize that you can't delete an item from the iOS bundle since it's signed, but is there a way to include a file and have it not be part of the "signed" bundle, but still present on install?

Use case is basically install the app, read the contents of the file, store in the keychain, then delete the file.

Thanks for any help and guidance.

Of note -> The app can't access the internet to fetch this file. And being able to delete the file (or wipe the file's contents) after reading it once is all I really need. Also, we're ad-hoc distribution here, we don't go through any App Approval process.

like image 442
Breland Avatar asked Apr 09 '13 18:04

Breland


1 Answers

The short answer is No. The app bundle is read only.

As others have pointed out, the usual solution for delivering data in the bundle that needs to be editable is to copy data from the application bundle to the documents (or other app folder) so that you have an editable copy. However, you still cannot delete anything from the bundle.

Since your project has restrictions where you cannot transmit the data through the Internet, and you are delivering the application via Ad-Hoc distribution, it seems like your primary concern is that the delivered file cannot be accessible, even on a jail broken device.

Since you cannot delete the file to make it unreadable, your next best bet is to encrypt the file to make it unreadable. Your app could decrypt the contents, use it, and dispose of the decrypted version. Of course, this is still not bulletproof, since decryption requires a key which you must protect, but it's about as bulletproof as you're going to get.

like image 173
Marcus Adams Avatar answered Oct 22 '22 22:10

Marcus Adams