Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically change a .ipa file on server

I have a .ipa file (iOS app) that I'm letting users install ad-hoc (Over the air on a private server, using an enterprise account).

Challenge is that the apps differentiate a bit from app to app. They have different logos and a different url they use inside the app.

Is it possible to dynamically change a .ipa file I have on my server before people download it?

Further Explanation:

I have to stress, that I can't make an .ipa file for each app. I HAVE to be able to change start screen, logo and set an url variable for a single .ipa file.

I other words, I need to DYNAMICALLY change the .ipa file on the server each time someone wants to download it.

What I would love to have:

I would love to have an example/guide on how to do this on a heroku or amazon server. Nothing fancy. Basically just changing a variable in the info.plist and then codesign it again afterwards.

like image 579
Holger Sindbaek Avatar asked Dec 11 '22 13:12

Holger Sindbaek


1 Answers

As has been stated you can simply unzip and zip again to create your own ipa.

All you further need is to add some resources that don't need code signing.

Your best bet would be to create a new (empty) directory in the ipa. Directories themselves are not signed, but are extracted on the device and can be detected by your code.

In other words: the CodeResources file containing the signatures does not change when adding an empty directory.

A simple test I just did, was to create a folder reference to a folder called "extra", the contents of which are decoded using percent encoding and displayed in a popup:

NSString *path = [[NSBundle mainBundle] pathForResource:@"extra" ofType:@""];
NSDirectoryEnumerator *direnum = [[NSFileManager defaultManager] enumeratorAtPath:path];
NSString *f;
while (f = [direnum nextObject])
{
    NSString *decoded = [f stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:nil message:decoded delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
    [alert show];
}

This can be used to send subliminal messages to your code. Percent encoding allows you to put in any character you like. I tested filename lengths up to 100 chars.

All you further need is some code to dynamically add an empty directory under Payload/yourapp.app/extra/ to the ipa, with the percent encoded message as its filename, e.g. Payload/yourapp.app/extra/http%3A%2F%2Fstackoverflow.com%2F

update: example shell commands to add a directory to an ipa:

$ mkdir -p Payload/myapp.app/extra/http%3A%2F%2Fstackoverflow.com%2F
$ zip -r myapp.ipa Payload/
updating: Payload/ (stored 0%)
updating: Payload/myapp.app/ (stored 0%) 
updating: Payload/myapp.app/extra/ (stored 0%) 
 adding: Payload/myapp.app/extra/http%3A%2F%2Fstackoverflow.com%2F/ (stored 0%) 
$ rm -r Payload/

You will of course need to create a clean copy of the ipa every time, or the urls will pile up under /extra/ inside the ipa.

like image 80
mvds Avatar answered Dec 26 '22 00:12

mvds