In this post, I’m going to show how to take a normal Flash project made in FlashDevelop and make it work for your iDevices.
First, you’ll need to download Adobe AIR 2.6 and start a project using it. Then, you can simply copy-paste your game with all of it’s contents into this new project and compile. Starting with this new, AIR 2.6 compiled SWF, you can start the process of making it work for an iPhone/iPod Touch/iPad device. At the very end of the tutorial, I will have packaging .bat files and an example XML app descriptor file.
1. You’re going to need to become an Apple Developer to get this to work; it costs $99 for app development. You will not need an actual Mac to do any of the following sections, except for the final upload of the app, as that must be done using the App Loader that only works on Mac computers. I personally just used Windows for the whole of development, and simply had a friend of mine do the actual uploading of the App.
2. Install OpenSSL for Windows. This will be needed in order to make a Certificate Signing Request (CSR). Here is a .bat file you can run that will accomplish this for you:
path %PATH%;C:\OPENSSL FILEPATH\bin
openssl genrsa -out -passout pass:YOURPASSWORD mykey.key 2048
openssl req -new -key mykey.key ^
-out CERTIFICATESIGNINGREQUESTFILENAME.certSigningRequest ^
-subj “/emailAddress=YOUREMAIL@example.com, CN=YOUR NAME, C=US”
3. Using your new CSR, you can upload it to your Apple Developer Provisioning Portal (under “Certificates”) to get a certificate. If you are working individually (essentially, there’s no team admin who will need to approve your certificate) just reload the page and you should be able to download the certificate file. This file will be named “developer_identity.cer”. Using this, you can now attach provisioning profiles to it (we haven’t made any yet, so don’t be surprised if you can’t!), as shown below with the attached “Home” and “Connor Ullmann” profiles attached to mine.
4. Next, plug in a device you want to test your program with and open up iTunes. Click on the device’s name, and open up the summary. There, you will see the Name, Capacity, Software Version, and the Serial Number. Click on the serial number, and you will see the Unique Device ID (UDID) appear in its place.
Now, go to the “Devices” tab in the Provisioning Portal and click “Add Devices.” Enter the name of your device, and enter in the 40-character UDID.
5. Let’s make an App ID! Go to the “App ID” section in the Provisioning Portal and click “New App ID” in the upper-right. Fill out the form with a name like “Quietus” for my game Quietus, have a new seed be generated in the drop-down menu, and make a suffix that goes by the form of “com.yourname.appname”.
6. We can now make a provisioning profile that will allow this device to run a program you put on it; you can’t simply put your app on any device, as with the Android App Store without it making it through a review by Apple in the Apple App Store. To make a provisioning profile, go to the “Provisioning” tab in the Provisioning Portal and click on the “New Profile” button, or simply click here. Add any device you wish to allow to run with this provisioning profile, and click submit. Then, you can now hit “Download” to the right of the profile table to download the provisioning profile (it’s file-extension is .mobileprovision).
7. With iTunes open and synced with your device, open up the folder with the newly downloaded provisioning profile and drop it into iTunes. Now, sync your device with iTunes again.
8. Execute this .bat with the path for you OpenSSL’s bin directory, and you will get a p12 certificate.
path %PATH%;C:\OPENSSL FILEPATH\bin
openssl x509 -in developer_identity.cer -inform DER ^
-out developer_pem_identity.pem -outform PEM
openssl pkcs12 -export -inkey mykey.key ^
-in developer_pem_identity.pem -out iphone_dev.p12
9. At this point, you will have a plethora of different files, like your CSR, your CER, your .mobileprovision, your mykey.key, your iphone_dev.p12, etc. For the most part, you will be able to ignore all of them except for the .p12, which will be packaged with all of your files (the SWF, the p12, the app descriptor XML file, the default start-up images, and the icon images) in the final .ipa which will run on your device. Make the appropriate changes to this template below for your application descriptor file (save as “application.xml”, for example):
More information about the XML document can be found here.
<?xml version=”1.0″ encoding=”utf-8″ ?>
<filename>APP NAME (put what you like, like “MyAppiOS”)</filename>
<name>NAME (this shows on the actual iPod as the name)</name>
10. When you have compiled your SWF file and have finished all of the previous steps, you will be able to package your application. In the same folder that you run the final packaging .bat file from, you will need the SWF, the p12, you app descriptor XML, your .mobileprovision file, your icon images (size 29×29, 48×48, 57×57, 72×72, and 512×512), and default images to show just before start-up (called Default.png, Default-Portrait.png, and Default-Landscape.png; these will make your app seem as though it’s loading faster by showing an image directly before the app actually starts). Below is an example image of my project “Quietus” before packaging with all of the necessary files:
Here is a .bat that you will run, with the necessary changes:
Note: when executing this .bat file, if you are asked for a password, use the password you entered when making your key in step 2.
path %PATH%;C:\AIR 2.6 FILEPATH\bin\
adt -package ^
-target ipa-test -provisioning-profile MOBILEPROVISIONFILENAME.mobileprovision ^
-keystore P12FILENAME.p12 -storetype pkcs12 ^
OUTPUTIPAFILENAME.ipa APPINFOXMLFILENAME.xml INPUTSWFFILENAME.swf ^
ICON29x29.png ICON48x48.png ICON57x57.png ICON72x72.png ICON512x512.png ^
Default.png Default-Landscape.png Default-Portrait.png
11. This .bat will output a .ipa file; this is the final app file that you will be able to play on a device that is allowed to use it, as given when you set up the provisioning profile. To try this out, just drag and drop the .ipa file into your iTunes and sync your device. If everything works out, your device should now have your app on it, and it should run!
Final Notes: Here’s a little bit of iPod/iPhone/iPad information. AIR 2.6 only works on iPhone/iPod Touch 3GS+, and works on both iPads, so iPhone 3G isn’t supported. Also, the iPod/iPhone resolution is 960×640 with the retina display, and the iPad is 1024×768.
I hope you enjoy making iOS apps, and I will be happy to answer any questions in the comments!