Loading External Bundle Files allowed? - ios

We are trying to load external NSBundle files remotely using a technique similar to below
loading NSBundle files on iOS
Does anyone know whether apple allow you to do this?
I assume as long as you don't change the functionality it is allowed?
Thanks for all your help

You should ask Apple to be sure, but probably no.
The bundle can contain image / data resources but also code, and there is a restriction guideline against running code that wasn't in the app when it was reviewed. If you're just loading image / data resources then you'll probably be fine. Code resources, you might get through review but would likely be pulled if found out.

Related

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

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.

Providing initial files in /Documents/ folder in an iOS app

Strangely I can't find a lot of information on this.
I am making an application that downloads images, they are downloaded and saved into my apps /Documents/ folder. To avoid an initial huge download I want to ship the app with ~100 images already "downloaded" into the folder.
How can I do this?
They have to go into your Resources bundle. You can then copy them into Documents on first launch. Yes, this means they take twice the space; if you can compress the ones in Resources effectively, I would.
An ideal answer is to have your loading routine be willing to look in both Documents and your Resources bundle and merge the results. I don't believe any built-in controllers will do this for you, however.

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.

Is it possible to delete a file from my iOS app's bundle?

I currently have a large .sqlite data store of long string text. It's about 160MB and will grow to about 200MB when I'm completely done. This is a "read only" data set.
What I do now is simply place that file in my bundle and read it during runtime. However, that means the app requires you to download 160MB. Not optimal.
One solution is to gzip that file, ship the gzipped version in the bundle, uncompress it on first run, and put it in the Documents/ folder. This means you'd download far less, but the total size the app uses on the device is (size of gzip'd + size of ungzip'd) which is obviously not optimal either.
I want to use the gzip solution, but after application's first run, I want to delete the .gz version. Is this possible? How do I achieve it? What would another good solution be?
It is not possible to delete a file in the bundle. The app must be signed and if the bundle is modified in any way, it will not pass the signature.
The only other solution I can think of, is to setup a web service, and have your app download portions of your content as necessary. This may or may not be a viable solution, depending on what your app is actually doing.
As Paul says, anything in your bundle is part of the signature.
I can't see this changing as it is a fundamental part of signing apps.
The other classic approach is to compress the data in your bundle, as heavily as possible, so you unpack it when you build the working storage.

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

Resources