tags:

views:

34

answers:

3

I have a game where each level has its own logic,so its a module with level -specific code and graphics. I am confused on whether its possible to download and integrate dynamically in the app each level. Searching the web , i found that nsbundle is the standard way for performing this task,however loadable bundles are not supported in iOS. Is there a way to approach such a task,and if yes ,its not clear to me if its even permitted by Apple

+1  A: 

Why do not you want just hide all extra levels in your app and unlock/show them instead of downloading? By the way, apple will not allow you plugging in any code that is not approved by them.

spbfox
A: 

Downloading code is not allowed by the App Store rules.

Eiko
A: 

Thechnically, it's possible by simply saving the files you want into the document folder of your app.

You can get this path with:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];

Then use whatever API to write your levels there.

Now while you are allowed to download additional assets, you are not allowed to download additional code. But I'm unclear on this, I know an app that download some .lua script files and never had any trouble with Apple. For the legal side, you'll have to trust someone else.

EDIT: By code, I mean compiled code (like a dylib), while using dlopen of the iPhone may work, it's not allowed or documented.

Nicolas Goy
This will work with resources, not with code.
spbfox
You may download any compiled code to the document folder and then dlopen it. I have never actually done it, but I don't see why it would not work. According you sign your dylib properly.
Nicolas Goy
thanks for the responses,my intent was to not push an app update every time a new level was available,but that seems the only "legal" way
tasos