Monday, September 8, 2008

How do you create an .ipa file?

This is taken from discussion forum and I found it very useful

What you need:
1: An app
2: A patched MobileInstallation file installed on your iPhone or iPod Touch.
3: Lastly, you need to know that when I say "ProgName", substitute the name of the program you're working with
Getting the iTunesArtwork file
The iTunesArtwork file is simply a jpeg image with the extension taken off, and is included in application's install folder on your device for every app downloaded from the app store. This image is what appears in the Applications section of iTunes as the icon for the app, and is definitely nice to have -- if you don't have it, you get a generic, black icon that no one wants to see. If you have the iTunesArtwork file, skip all this and go down to the next red headline! Otherwise, read on:
1: Open iTunes on your computer and find your application in the iTunes Music Store. On the application's page, find the app icon at the top-left corner of the page and right-click it. Now choose "Copy iTunes Store URL". Your clipboard now contains something like this:

2. run this script (which I created) in mac, eg ./ 284962368
Shell script: getappicon.shSelect all

url=`curl -s -L "{$1}&mt=8" | gunzip | grep '100x100-75.jpg' | cut -f22 -d"\""`
appname=`curl -s -L "{$1}&mt=8" | gunzip | grep '100x100-75.jpg' | cut -f16 -d"\""`
if [ "$appname" = "0" ] ; then
appname=`curl -s -L "{$1}&mt=8" | gunzip | grep '100x100-75.jpg' | cut -f18 -d"\""`
echo ${appname}

curl ${url100} > ${1}.jpg

url512=`echo ${url100} | perl -pe 's/100/512/g'`
curl ${url512} > ${1}_512.jpg

3: Then you will get two jpg files, 284962368_512.jpg & 284962368.jpg Rename the 512 jpeg to iTunesArtwork. You've just gotten your iTunesArtwork file.

Bundling the .IPA
1: Create a folder on your desktop called "working". Open that, and create another folder inside of it called "Payload". Case-sensitive.
2: Move your iTunesArtwork file into the "working" folder, and your .app into the Payload folder.
3: Mac and Linux users only: Open Terminal and run the following command:
chmod -R 775 ~/Desktop/working/Payload
4: Go into your folder within Payload (Mac users, right-click and choose Show Package Contents).
5 (For Mac users with Dev Tools installed ONLY): Double-click the Info.plist file. The Property List Editor will open and show a simple table. Click the last row of the table, then press the + button that appears to create a new row at the bottom. In the first new cell enter
and in the second new cell, enter
Apple iPhone OS Application Signing
Save this file.
5 (For Windows, Linux, and other Macs): Visit the following site: (You may have to Approve the security certificate -- don't worry, it's safe)
Browse for your Info.plist file, and press the "Convert" button. Save the resulting file to your computer. Windows users, open this file in WordPad. Mac and Linux users can use any text editor.
scroll to the bottom of the file and make a new line just before
And paste the following in that spot:
<string>Apple iPhone OS Application Signing</string>
The end of the file should now look like this:
<string>Apple iPhone OS Application Signing</string>
Save the file (Make sure the name is Info.plist -- case sensitive!) and replace the Info.plist in with it.
6: Time to zip it up. Use your favorite method to zip the iTunesArtwork file and Payload folder together in one .zip file. Mac users can select both, right-click, and choose "Compress 2 Items". Windows users can select both, right-click, and choose "Add to Archive" (remember to select ZIP, not RAR if that option is available).
If you unzip the file, you should see this structure:

7: Rename the zip file to ProgName.ipa
8: All done! Congratulations!


Anonymous said...

Thanks SO much for an nice concise writeup like this.
I was able to package up an .ipa no problem.
I tried your script, and the jpg images it downloaded were 'corrupt' and unusable.
I saved your code in xcode as an .sh file and ran it with the app# taken from the url in itunes store for the specific app in terminal, just like you wrote.
I'm not sure what I did wrong, any suggestions?

ck said...

I have updated that script.

Anonymous said...

Thank you too much for that a great lesson, however i did every thing you said step by step, but the iTunes did not accept the ipa app. !!!

an error msg said that not valid app.

can you help me solv this plz.

by the way, i read in internet somthing about the iphone certificate .. and i do not have one , can this be the problem ?

if yes, is there any solution ?

thanx again ..

Anonymous said...

I just went through the painfull process of zipping, renaming and seeing, that the ipa file is not valid. I'm using windows/total commander.

And I hope I've found the solution. The zip is not always the zip - as far as we are talking about iphone recognition of the file. I've downloaded the latest winzip and packed the files (payload folder and itunes artwork) to the one zip IN LEGACY MODE.

And it seems it's where the problem is. After renaming the zip to ipa, everything worked as I've expected.

Hope it helps you

Anonymous said...

Well i like to thank you actually for making it so clear on how to create an IPA, i had the error also iun the beginning but using the guidence and creating a puicture that is exactly 512x512 i was able to create my own ipa and it does sync to my phone, with a developers certificate on my iPhone...

Christian said...

itunes won't copy my ipk. does someone has a solution, that itunes will copy the ipk?

Anonymous said...

Hi i did this, and now am getting a error message when trying to sync up my ipod to the app i get "app failed to download because its resources have been modified" Or something close to that