Add file to already packaged .ipa - ios

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!

Finally found a proper solution.
This is a step by step guide to add or alter files to the already packaged ipa;
Rename the .ipa package to .zip
Extract the .zip package
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
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"
Zip the Payload again.
That's basically it. Now you can alter "File.txt" as long as you want without invalidating the ipa package.

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

Related

Is that safe to share .xcarchive?

I`m somehow amateur in Xcode and this matter is so important for me.
My Friend use his developer id to publish my app and he ask me to give him .xcarchive instead *.ipa file
As I read in stackoverflow topics .xcarchive have the same content of ipa and there is no concern about lose and steal source code.
But when I check my xcarchive and use show content option I see most of project files like images and sources in application folder , also some of my code are in *.nib files
Is that normal ? and if I extract ipa if I get the same result ?
Is there any security or tips in Xcode that better to active before archive project ?
It is normal. In order to publish your app, your friend really needs the xcarchive, because they need to export an IPA file with the appropriate provisioning profile and signed with their code signing identity. Although it's possible to replace the provisioning profile in an IPA file and re-sign it again, it's a daunting task you don't want any of your friends to do. If you trust your friend with publishing your app, you should trust them and share the xcarchive.
When you compare the contents of xcarchive and IPA files, you can see xcarchive contains a dSYMs folder with dSYM files used to desymbolicate your crash logs -- the developer needs that to know in what file and at what line number the application crashed.

Change app Version with only IPA file provided (no xcode)

I have an app that was developed for my company. Unfortunately it needs to be resigned (i know how do this part) because the distribution cert has expired. The problem is we need to change the version number so it allows for an update on all iPads. Does anyone know how to do this using terminal (i have xcode installed but i dont have and of the files from the developers). Once again, i only have the IPA file for the app.
Thanks for any help.
Rename the .ipa to .zip, and unzip the archive.
Inside should be a folder called "payload", and inside that folder should be your application archive.
Right-click the application archive, and choose "show package contents."
Find the Info.plist file (either named "Info.plist" or "AppName_Info.plist"). Open that file with a text editor
Change the value of "CFBundleVersion" and "CFBundleShortVersionString" to your desired version number.
Re-zip the archive
Rename the .zip to .ipa
Re-sign the .ipa
In answer to Chris Emerson's comment above (sorry, I don't have enough reputation to add another comment so I'm adding an answer) it is still possible to do this! I have just done it for an IPA with latest updates to everything iOS 8.3, OX Mavericks. I was getting the same message "... could not be installed at this time" and it turned out to be an issue with the entitlements in the provisioning profile not matching the entitlements in the *.app.
You can check the entitlements in both like this: https://developer.apple.com/library/ios/technotes/tn2318/_index.html#//apple_ref/doc/uid/DTS40013777-CH1-TNTAG68, and I put an answer detailing how I fixed the entitlements of my IPA so that they matched here: Alter Minimum OS Version of IPA without XCode, iOS 8+.

iOS App loader - what file type should be uploaded

I have always been uploading iOS apps to appstore from XCode Organizer. That is pretty simple process. And we do not see any IPA or APP file is created. Now my client is trying himself to upload the app using app loader and is continuously asking for an IPA file. Now I have some specific questions -
Does app loader exist now-a-days ? Is it a different program out of XCode?
If it does, what file it takes from me to upload to appstore? An IPA?
How do I create the file for appstore? Note that I have the distribution certificate and appstore provisioning files installed and set in my release configuration. And I am sure if I have tried with XCode it would upload already. But, client not allowing me to do that. He will do it using app loader.
Special Notes -
1. Please do not give me links to an apple documentation, they do not talk about file type and how to create that. They always say "binary". Their doc titles does not reflect the content.
2. Please do not show me the Ad Hoc build process, that is not what I am asking.
3. Please only reply if you have used app loader before.
Application Loader is present in the Utilties folder.
For XCode 4.5 go to
XCode -> Right Click and select Show Package Contents
then go to Contents -> Applications -> Application Loader.
When you just do a build from Xcode, you get .app file.
To create .ipa from it follow below process:
On "/" create a folder named Payload
Copy your .app and .mobileprovision files in this folder.
Open terminal, go to / and run following command
zip -9 -y -r appName.ipa Payload/
This will create file "appName.ipa" on /
Yes and Yes.
As far as I know, it takes a compressed .app file.
In Xcode go to Products and select "show in finder". Then compress the file with a right click. The result should be uploaded with application loader. The result is located in the Library directory. Depending on your settings this can be hidden from application loader. Therefore you should copy the compressed file to a directory which is accessible from any program (like the desktop).

Application Loader gives error: Not a valid zip file

I'm trying to submit an app (.ipa) and the only error Application Loader gives is "Not a valid zip file." It doesn't say anything about signatures, provisioning profiles, certificates, or binaries, etc. What is the problem?
If you're emailing the .ipa to your client, make sure it isn't getting munged either by their email software/server or by yours. You may want to zip the .ipa (even though the ipa is already an archive format) in order to get the file to them without it being modified. Then they can unzip it and submit the ipa file. My guess is that the .ipa file suffix isn't being recognized by someone's mail software and that's damaging it somehow.
If your zip file name has a space in it, e.g. My App.zip, try renaming the zip file so that it has no spaces, and try to upload it again. I seem to recall this happening to me once, and this did the trick.

Problems creating an ipa file

I want to create an ipa file but I get the following error message. Maybee someone knows what's going on here? Or just a hint where the error might be.
Sometimes it may happen that Xcode Archiver fails to generate ipa file. Then here is the another option.
Build the application.
After successful build go to "Products" folder in your project navigator.
Right click on it and go to "Show in Finder".
Copy the .app file.
Create a new folder at some other location lets say on Desktop with name "Payload".
Paste that .app file in Payload folder.
Zip the Payload folder.
Rename that zipped folder with .ipa
Thats it.
Reverse procedure is used to retrieve the app file from an ipa file.
Hope this answer helps.
Check to make sure you have changed your Code Signing Identity to a Distribution profile, rather than your Developer profile cert. You need to explicitly create a Distribution cert in the provisioning areas of the Apple Developer website.
Here are two links that are pretty helpful, first and second.

Resources