iOS - Can users access App Bundle Contents (specifically the Bundle Resources) - ios

I'm relatively new to iOS development. My question is quite simple but there seems to be a lot of un-complete answers out there.
For example, I have a few pictures that are used in my app and I don't want the users to have access to these pictures at all (due to copyright). I've included these into the "Bundle Resources" along with the "Image.cxassets" and other .xib files.
Will the user ever be able to access the pictures? (I understand that the user can't access the Library folder but it seems to be a pain to copy the pictures into the Library folder at app first launch.)
thanks ahead for answering.

I didn't understand what exactly you're asking, but for users to access your app bundle contents the file sharing for iTunes option should be set in .plist. See in the reference
Although you may put dot before file ".image.jpg" to make it hidden but it sounds like temporary solution.

Related

How to restrict ios sandbox access from .app file (Migrating an App to a Sandbox)

I am able to see the source code from my .app file that is i am able access image
files. How can i restrict that? I dont want my user to access the files from app. Please help me in resolving this issue.
Update: Sorry i was supposed to write .h/.m files are not accessed but image files can..
There is a mismatch in type , i didn't observe
You cannot see code from the IPA you upload to the store. No one can see your code. Someone could, however, see you image files, audio files, sqlite files, plist files, etc.
Per your update:
You cannot prevent the files from being accessed. It's like the web: if you can see it, you can steal it.

Encrypting or protecting files stored in iOS app's NSDocumentsDirectory

I have a custom requirement in one of my products and I need to protect or encrypt files that are stored inside the NSDocumentsDirectory folder. Even if these documents are mailed (The app has the ability to mail documents) to some other person , he or she will not be able to open this document without using my app (I will be using open in functionality of email attachments). So basically only the application can access all these documents and without the app the documents should be mere junk. IS there any way to do it, or has any one done something before.
I also saw this but could not get a complete idea.
If you want a quick and easy method for data that doesn't need serious security, just zip the files with a fixed password.
ZipArchive is a good library for this.
For a more serious approach, check iOS - Protecting files with a custom encryption key?
The other post you mentioned works on the concept of password protecting the files, I had encountered the same issue that was for my custom defined files in which our team, encoded the contents of the file on random locations, and saved it.
Only our Application could decode it correctly as we had the key :)
It was a windows application, It would work here also.

Putting App Resources in Document Directory in iOS

My app have too much dynamic app resources like images, html+css and xml or json files..that can be updated, So I cannot put these resources in app bundle it will not get updated once on app store i need to have it updated there...secondly i also cannot put these resources on server where I can request the content from server every time i need it...
So my question is that is good to store data locally in document directory??? how does apple app review team will react to it? I have heard that there is an iCloud problem while putting data in document directory is it right?
So where to store data of iOS application locally on device?
Thanks in Advance.... Looking for some good solid answer!
This kind of data should be copied to ~/Library/Application Support. See the File System Programming Guide for full details on where everything goes and how it will be treated.
You may want to consider having the initial assets you are referring to be resident in your application bundle. And then when you have updated versions, save them in your Documents directory (or any legal path you want).
The reason for this is for failover, in case there is a problem, it allows you to revert back. When you are dynamically loading content, you have to factor in you can encounter various problems during a download such as corrupt data or even a dependency not being downloaded yet.
FWIW, I implemented this for a game that supported dynamic loading of content. The bundle had the original assets. There was a temp download directory. When data was validated, it was moved to a locale where it was consumable. On app start, the first step was to just copy the data from the bundle to the consumable directory. While it seems perhaps wasteful and several steps, it worked surprising well and most would not even know this sort of thing was happening.

Add downloaded resources (images) to Bundle?

I am developing an application which is a kind of contact list. This list is updated each times the applications starts.
Each contact in the list has its own photo. A part of this list is common for every user of this application. For this part, I already have all the needed pics and I inlude them in the bundle/archive (which will be sent to Apple).
The pics of the new contacts (added during the lifetime of the app) are downloaded from a remote server (using ASIHTTPRequest). But I don't know how to handle these downloaded pics easily.
I am looking for a way to add these downloaded pics to the main bundle so I can call them using :
+ (UIImage *)imageNamed:(NSString *)name
Do you have any idea of the good practices for this kind of things ?
If new resources can't be added to the main bundle, what are your recommendations ?
Thanks again for your help !
kheraud
You can only add files to your App's Documents directory. The main bundle can't be modified after your App has been released. Read the documentation on how to write to the directory.
Edit_: This should help you to get started http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/StandardBehaviors/StandardBehaviors.html%23//apple_ref/doc/uid/TP40007072-CH4-SW6
I'm doing a similar thing for an app, and in the past I've used a couple of different Categories for UIImage.
For the current version I'm looking at https://github.com/rs/SDWebImage but I had really good luck using this one in a previous version https://github.com/jaanus/UIImageViewCached. For my purpose, I was downloading images from a URL and then caching them for use in a TableView.
HTH

Can I save user input to a plist that lives in the resources folder on iOS?

I have a plist in my Resources folder that I'm using to store conversion information. I'd like to give the user the ability to "turn off" certain units so that those units will never be used in conversions. I don't want to have to maintain two lists with the conversion information in it.
I am able to save data back to that plist file in the stimulator. (using writeToFile and the pathForResource). I'm wondering if this is a problematic approach.
Will there be an issues with this on deployment? (i.e. will Apple seal the plist)
What will happen if I push out an upgrade? What if that upgrade contains new units added to the list?
Would doing something like copying the plist to the user's documents directory make sense?
It is not possible to change the app bundle. Further the app is signed. Instead copy the plist to the documents directory on first start and access from there.
No whatever is in the application bundle is offlimit has the DRM on iPhone needs it to stay the same. You should save your preferences in the Apllication Document folder or Preference folder.
Use an iOS Settings Bundle...

Resources