AlBirdie
AlBirdie

Reputation: 2071

Add file to already packaged .ipa

As the title says I'm looking for ways to add an additional file to an already packaged .ipa. We need this for an in-house app to add a saml certificate to the ipa so that the user doesn't need username/password any more to log in.

Adding the file on the server when the download request comes from the user isn't the issue, the problem is, that the ipa won't install on the device any more.

I've read in the Apple documentation that you can omit certain files from being signed, so I extracted the ipa using "The Unarchiver" on a Mac, and added the following to the ResourceRules.plist;

saml.txt omit weight 200

I also tried omitting all txt files, as described here: http://lists.apple.com/archives/xcode-users/2011/Apr/msg00277.html

(^Resources/.*.txt omit YES weight 200")

First off, I don't really know what rule the weight property plays. I wasn't able to find any documentation about this.

Anyways, I saved the file, compressed the Payload again using the tools OS X provides and renamed it to the required ipa filename. Unfortunately, the ipa won't install on a device. It downloads fine, but installation fails.

What am I doing wrong here and how to I overcome this issue?

Since it probably matters, the ipa is generated with Flash Builder, so I don't have all the build settings available that XCode has.

If someone's got a hint, please let me know! Cheers!

Upvotes: 0

Views: 3382

Answers (2)

AlBirdie
AlBirdie

Reputation: 2071

Finally found a proper solution. This is a step by step guide to add or alter files to the already packaged ipa;

  1. Rename the .ipa package to .zip
  2. Extract the .zip package
  3. Go into the Payload's app content's directory and change the ResourceRules.plist file to your needs. In our case, we needed to add another file to the list of excluded files.

    File.txt omit weight 10000

  4. Using Apple's codesign, re-sign the package with the new ResourceRules:

    codesign -f -s "iPhone Distribution: cert name" --resource-rules "Payload/AppName.app/ResourceRules.plist" "Payload/AppName.app"

  5. Zip the Payload again.

That's basically it. Now you can alter "File.txt" as long as you want without invalidating the ipa package.

Upvotes: 1

Rajeev Barnwal
Rajeev Barnwal

Reputation: 1347

.ipa file is a packaged "zip" files in other words. Which contains all of your application codes and all the .h & .m files. So it is basically a zip file of your complete xcode project.

Now once the file is zipped (.ipa) file its not possible to add any thing till the time the file has been extracted.

And no one in the world except Apple can do add files to a .ipa file.

Hope this will help you.

Upvotes: -1

Related Questions