The challenge: Create a Flash App, pack it with the Packager for iPhone with my certificate and provisioning profiles, send it to the client that he can resign it with his informations and import it into Xcode Organizer for validating and uploading to the App Store.
I did some research and found out that all signing processes in Xcode (while building or resigning in Organizer) is done with a tool called codesign. This tool can also be used via Terminal. I tried it with my Flash .ipa and the included .app. It worked.
But because it is difficult always to use the terminal with more lines long commands I decided to develop a little AIR tool using the new NativeProcess API.
And here is how it works:
Find the first .app file inside /Payload.
Load the Info.plist file.
Use the CFBundleExecutable as the binary filename.
The current Signing Authority is read and the entitlements were extracted. The entitlements are needed, because without them the Xcode Organizer can’t sign the app with a new Provisioning Certificate.
4. Resign App and change App ID.
The binary will be resigned with your new informations.
What is executed:
First, codesign with your extracted entitlements:
Second, change the the Bundle Identifier also inside the Info.plist file.
How does this work:
This was a little bit tricky and needed much research how the Organizer wants the Apps.
Every Archived Build is moved to /UserDir/Library/MobileDevice/Archived Applications/UUID.
So first a UUID is generated an a directory with it is created.
e.g. /UserDir/Library/MobileDevice/Archived Applications/8D3E5DF2-F079-4A3B-460D-5525A6C5472B
Then the .app file is copied to that location. But the Orgnanizer needs an ArchiveInfo.plist file with correct informations in it.
My tool uses a standard template and changes all needed information, so that they are matching the informations in your .apps Info.plist file. These are CFBundleIdentifier, CFBundleDisplayName, CFBundleVersion, MinimumOSVersion, DTPlatformVersion, DTSDKName, CFBundleExecutable, CFBundleDisplayName.
Some other data needs to be generated out of other information. e.g. the UUID of the directory or the Archivedate.
Apple counts dates from 01.01.2001 – 00:00:00. Surprising.
At the moment this works only with Flash iPhone Apps. I tried it quickly with another .ipa but it fails. I did no investigation in it because at the moment I didn’t need it.
Xcode Organizer fails silent. But you can look at the Terminal messages of codesign in your Console Log (Konsole in german). Maybe there you can find why validating or uploading fails.
If you make changes or enhancements please share them with me