0

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!

AlBirdie
  • 2,071
  • 1
  • 25
  • 45
  • Since we weren't able to add any files to the package and omit them from the signing process, we simply added .supp files to the SC_Info directory, since the ResourceRules already omit these files. That solved the problem, though adding custom rules to the ResourceRules and re-sign the package would be nicer. – AlBirdie Jul 25 '13 at 12:44
  • As of iOS7, SC_Info is read protected, so we're desperately looking for a way to omit certain files from the signing process. If anyone's got a clue, please shoot! – AlBirdie Sep 23 '13 at 13:10

2 Answers2

1

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.

AlBirdie
  • 2,071
  • 1
  • 25
  • 45
0

.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.

Rajeev Barnwal
  • 1,349
  • 11
  • 14
  • I'm afraid your answer isn't correct, you can add and alter files of the already packaged .ipa using codesign. – AlBirdie Jul 25 '13 at 07:59
  • Hi Friend, I belive we are talking about Code Signing identity? Correct? Code signing is a security technology, used in OS X, that allows you to certify that an app was created by you. Once an app is signed, the system can detect any change to the app—whether the change is introduced accidentally or by malicious code. – Rajeev Barnwal Jul 25 '13 at 14:33
  • Well, you can alter files in the already signed .app package. There are certain files that are going to be omitted by the signing process, which allows you to alter those files to your needs. We've just done that as described my comment to the initial post, so it is possible without invalidating the signed package. – AlBirdie Jul 25 '13 at 14:52