user1573607
user1573607

Reputation: 522

iOS - Execute precompiled app from a server

I'm looking for executing a .xib (with its own controllers and libraries) precompiled on a server, downloading it on runtime. Is it possible?

Thanks!

EDIT:

So could somebody give me an example of a program that uses NSBundle that executes other app? And how do I create the bundled application?

Upvotes: 0

Views: 127

Answers (3)

Caleb
Caleb

Reputation: 124997

A .xib file is just a data file, so there shouldn't be any problem loading one that's outside your app's bundle. I can't say I've ever tried it, but as long as it's in a bundle, you should be able to:

  1. Create an instance of NSBundle using the path to the bundle containing the .xib you want to load. See +[NSBundle bundleWithPath:] for that.

  2. Load the .xib using the bundle you created in the previous step with any of the normal .xib-loading methods, such as -[UIViewController initWithNibNamed:bundle:] or +[UINib nibWithNibName:bundle:].

with it's own controllers and libraries

That part won't work. iOS doesn't allow dynamic linking to frameworks other than the ones provided by the system, so there's no way to load your code. If you can build all the code you need into your app, though, you should still be able to use downloaded .xib's as described above. That would let you do things like update the way your views are laid out or what targets and actions your controls are connected to.

Upvotes: 0

Chris Maddern
Chris Maddern

Reputation: 767

I can think of a couple of ways you could try to do this, but are you aiming to get it in to the store?

This is expressly prohibited by Apple Developer Guidelines.

Upvotes: 1

AustinRathe
AustinRathe

Reputation: 681

I don't think you can import a xib into the application's bundle at run-time (which you would have to in order for this to happen). Others may know more and correct me!

Upvotes: 2

Related Questions