Tag Archives: Apple

Flash to iOS: A Step-by-Step Tutorial (Part 5)

Flash to iOS: A Step-by-Step Tutorial

This is the fifth part of our tutorial series by Intern Sina on creating an AIR application for free on a PC using FlashDevelop, and deploying it as a native app on an iOS device like the Apple iPad, iPhone or iPod Touch.

Jump to other parts in the series:

Distribution Certificate

Now that you’ve tested your app and it’s to your liking, guess you want to put it up on the App Store? Never fear, my friend! I will now show you how to get your app uploaded on the App Store so the whole world can ignore it and buy Angry Birds instead.

This process of distribution is a bittersweet one. It’s sweet because it’s extremely similar to the development process that you just went through, so you should be familiar with the convoluted certificates and hoops you have to jump through at Apple’s pleasure. It’s bitter because it’s extremely similar to the development process that you just went through.

Groundhog Day

Something about this seems awfully familiar …

Enough talk. Let’s get cracking!

Generate a Signing Certificate Request

Remember that OpenSSL program that you installed in Part 2 of this tutorial? You have to open that bad boy up again to create another Certificate Signing Request. Now, it is possible to just use your old Signing Certificate – however, just to be super clear and to avoid any confusion or difficulty, we’re going to create another one.

Note: We’ll use this new Signing Certificate Request to get a Distribution Certificate rather than a Development Certificate.

  1. Open a command prompt window. You can do this by clicking the Windows Start button and typing in cmd in the search field. Alternately, you can also hold the Windows key on your keyboard and hit the “R” key (for “Run”), then type cmd and hit Enter.

    Windows CLI

  2. Once you are in the command prompt, navigate to your Open SSL bin folder. Depending on where you installed it, you will have to navigate to a different path than in this example. (i hope you installed Open SSL in a location that you can remember!) Check Part 2 if you need a refresher on Windows CLI (Command Line Interpreter) commands.

    Open SSL folder

  3. Punch this command into the CLI and hit the ENTER key when you’re finished:
    openssl genrsa -out mykey.key 2048

    You should see this response:


  4. Next, type (or highlight the line, right-click, choose “Copy”, and right-click/”Paste” in the CLI):
    openssl req -new -key mykey.key -out CertificateSigningRequest.certSigningRequest  -subj "/emailAddress=yourAddress@example.com, CN=John Doe, C=US"

    Now, before you hit ENTER you’ll want to edit a couple of things. First, replace “John Doe” with your own name or company name. Then replace the “yourAddress@example.com” email with your own email. Press ENTER.

    You should get a message similar to this:

    Response 2

    You just generated the Signing Certificate Request file that you’ll use to ask Apple for your Distribution Signing Certificate. The Signing Certificate Request file is located in the bin folder of your Open SSL install. It has a .certSigningRequest file extension and should look like this:

    Signing Certificate

Obtain a Signing Certificate for Distribution

You have to upload your Signing Certificate Request file to the Apple Provisioning Portal to get your Distribution Signing Certificate. Onward.

Note: There have been instances where this upload does not work with Google Chrome. Just to be safe, use another browser like Firefox.

  1. Navigate to the Apple iOS Provisioning Portal within the Dev Center.

    Apple Provisioning Portal

  2. Log in with your developer account and click on Certificates.
  3. Click on the Distribution tab.

    Apple Provisioning Portal

    Note: In our previous tutorials, you requested a certificate from the Development tab. An app signed with a Development certificate cannot be successfully submitted to the Apple App Store.

    If you have an old Distribution Certificate because you’ve made a prior app, and you’d still like to follow along, you can go ahead and Revoke it. Revoking the Certificate will not affect your apps that are already on the App Store, because the Certificate is primarily used during the upload process so that Apple can identify you.

    Note: I recommend revoking an existing Certificate because Apple seems to issue only one Certificate per Team Agent. You must revoke any existing Certificate to be able to request another. Why is it set up like this? I have no idea.

    Revoke your Apple Signing Certificate

  4. If you don’t have a pre-existing Distribution Signing Certificate, you can just go ahead and click Request Certificate.

    Request your Apple Signing Certificate

    On the next screen, you will upload the Signing Certificate Request file that you generated in the previous section.


  5. Click the Browse button and navigate to the OpenSSL bin folder.
  6. Select the Signing Certificate Request file and click Submit. When you are finished, you’ll see your Distribution Signing Certificate ready to download from the web page.

    Your Apple Signing Certificate

Don’t download your Distribution Certificate quite yet. You still need to create an App ID and a Mobile Provisioning Profile.

Create a New App ID

When deciding what you want your App ID to be, you have two choices:

  • Create an entirely new App ID
  • Use the Existing App ID that you create in Part 2

If you want to use your existing App ID, then just skip to the next section. If for some reason you don’t like the name of your App ID, go ahead and make a new App ID, following the steps outlined in Part 2.

Create a Mobile Provisioning Profile for Distribution

Now that you have an App ID, you can create your Mobile Provisioning Profile.

  1. Within the Provisioning Portal website, click Provisioning in the sidebar.
  2. Click the Distribution tab.

    New Provisioning Profile

    In previous tutorials, you created a Development profile for testing. You won’t be able to upload your app to the Apple App Store unless you create a Distribution profile, so make sure you select the correct tab.

    You can either create a new Provisioning Profile, or modify an existing one. Modifying an existing profile if you want to switch between App Store and Ad Hoc distribution. If you’ve never created a Distribution profile, read on. Instructions for modifying a profile are in the section following.

  3. Click on New Profile.

    New Provisioning Profile Button

    Note: You’ll only see this option if you are the fee-paying Team Admin.

  4. In the next section, you’ll have to fill out a bunch of options. The first option is the Distribution Method. As you can see, you can choose between App Store and Ad Hoc.
    • Choose App Store if you are completely satisfied with your app and you want to submit it to Apple for review. If all goes well, then your app will be released whenever Apple deems it worthy.
    • The Ad Hoc option can be thought of as a closed beta for your app. When you choose Ad Hoc, you are able to release your app to a maximum of 100 people, and only they will have access to it. Your App will NOT appear in the public App Store if you choose Ad Hoc.

    Note: Notice when you choose App Store, the “Devices” option is greyed out. When you choose Ad Hoc, it allows you to choose a number of devices that you have registered. The App Store option releases your app on the public App Store, so it doesn’t make sense to target specific devices.

  5. Your Profile Name is the name that you want for your Provisioning Profile. The Distribution Certificate that you created should be visible here.
  6. Finally, you have to choose which App ID with which you want to register your Provisioning Profile.

    Profile Options

  7. Click Submit.
  8. You should ee a list of the Provisioning Profiles that you’ve created. Click download on the Provisioning Profile that you just created, and save it to you computer.

    Save Your Provisioning Profile

Modify your Provisioning Profile

Note: If you’re not modifying an existing Provisioning Profile (say, from Ad Hoc to App Store), skip over this section.

  1. Within the Provisioning Portal website, click Provisioning in the sidebar.
  2. Click the Distribution tab.

    New Provisioning Profile

  3. Click Modify on the Provisioning Profile that you want to reuse.

    Modify Provisioning Profile

  4. Switch to either Ad Hoc or App Store. The distinction between these two options is explained in the preceding section.

    Edit Provisioning Profile

  5. Click Submit.
  6. You should see a list of the Provisioning Profiles that you’ve created. Click download on the Provisioning Profile that you just modified, and save it to your computer.

    Save Your Provisioning Profile

Download your Distribution Certificate

You just need to download the Distribution Signing Certificate that you created at the top of this tutorial, and then you are ready to bundle your .ipa file to submit to the App Store.

  1. Click on the Certificates section in the sidebar.
  2. Click the Distribution tab.

    Apple Provisioning Portal

  3. You’ll see that your Distribution Signing Certificate is ready to download. You can also see that it contains the Distribution Provisioning Profile that you just made.

    Your Certificate is Ready

  • Click download and save the file to your computer. Just to make things easier, you can save that certificate in the Open SSL bin folder, where your Certificate Signing Request file is sitting.


    Note: Make sure not to get confused between your Development Certificate and Profile, and your Distribution Certificate and Profile. You won’t be able to upload your app to the App Store if you accidentally use the Distribution set of certs in these next steps.

    Convert the Signing Certificate to a .p12 File

    You’ll have to perform the .p12 conversion on your Certificate again, as you did in an earlier tutorial. Here are the steps:

    1. Open up your command prompt.
    2. Navigate to your Open SSL bin folder.
    3. Copy and paste this command:
      openssl x509 -in distribution_identity.cer -inform DER -out distribution_identity.pem -outform PEM

      After you enter that command, you’ll see a .pem file show up in your OpenSSL bin folder.

      .pem file

    4. Copy and paste this command in the CLI:
      openssl pkcs12 -export -inkey mykey.key -in distribution_identity.pem -out iphone_dev.p12

      Note: These are the exact same commands that you used for our Development Certificate in an earlier tutorial, except that the file name has been changed from “development” to “distribution”.

    5. After you punch in the command, enter a password and then verify that password. Make sure the password is something that you will remember. (Save it in a .txt file! – Ed.)

      Note: Remember that you may get an error mentioning a “random state”. Just type in the command set RANDFILE=.rnd and it should fix the problem for you.

    6. Navigate to the bin folder in your Open SSL directory and you should see your .p12 file. Hooray!

      .p12 file

    Hello, Planet

    As we mentioned off the top, much of this is familiar territory. With all of your Distribution certs sorted out, you’re ready to bundle up your final .ipa file and foist it onto an unsuspecting public. In the next tutorial, you’ll follow familiar instructions to bind your certs to your .ipa, and experience that magical moment of uploading your app for Apple’s approval (followed shortly by that equally magical moment of getting your app rejected cuz BEWBZ.) Let’s do it!

  • iMpressions

    As i mentioned in another post (iPhone vs. the Basement Battalion), our decreasing faith in Flash development has lead us to investigate the iPhone. Our experiments in self-publishing our own Flash games (chronicled in our ongoing and depressing Pimp My Game series) have shown that there’s too much free content online to reasonably compete. The pricing models for Flash games are between $10-20 for a trial-based game, and zero dollars for most others. There’s a vast no-man’s-land in between. i’ve never seen a Flash game available online for between $0.99 and $9.99. It could exist – i’ve just never seen it.

    So there’s a real need to fill in that pricing gap – the gap between “too much game” (i’m not likely to stick with Mystery Case Files long enough to get my ten dollars worth) and “not enough game” (the average length of time i’ll spend on a free online Flash game is two and a half seconds).

    Chrome Jellybean in Chicago

    Ok, so i’m supposed to match three of the … LOOK! A DISTRACTINGLY SHINY OBJECT!

    The (cr)App Store

    The iPhone App Store fills in that gap admirably. While you still have a glut of free, mostly poor-quality games and apps, there’s a spectrum of higher-quality entertainment up for grabs between that $0.99-$9.99 range. More than ten dollars for an iPhone game is largely unheard of. But there’s a lot of debate currently raging among developers about what some are calling the “race to 99 cents”. They’re accusing most developers of devaluing their work, or gaming the system to get more attention for their app, forcing everyone else in turn to keep cutting the price of their apps until everything levels out at 99 cents, the lowest possible price to charge for content on the App Store.

    Lengthy discussion follows many of these posts. And it was in reading these discussions that i formed my first impression of these strange beings, these “Mac people”, who i have been avoiding for so long.

    Supposed Mac and PC users

    i actually identify better with the witty fat guy than the arrogant, catty guy

    Once Bitten, Mac Shy

    i am a PC person. i’ve owned PCs for most of my life. i worked in a PC-only dev shop for over seven years. Every machine i’ve owned since i was 10 has been a PC. Because at 10 years old, i owned an Amiga.

    The Amiga systems were better than the x86 PCs of the time. They were better for artists and musicians. They had better music and video capabilities. Images, animations and movies all played better on Amiga systems. Sounds like a certain fruit-branded platform we know today, doesn’t it?

    Amiga 500

    The Amiga 500. It’s for artsy folks.

    The problem with the Amiga platform is that everybody bought PCs, and the Amiga became more and more niche, until eventually all the hot software came out for IBM PCs and “clones”, and Amiga owners were left to seek each other out in weird underground support/software swap groups that met in the catacombs beneath ancient churches. i hear they had their own secret handshake and blood rites.

    It was a lot like the BETAMax/VHS battle before it – you can argue til you’re fit to pop about which technology is best, and there may even be a clear winner … but the only thing that matters is what the majority of people buy. After i sunk $1000 into my Amiga 500 to buy a hard drive with a few MB of space on it, i saw the platform die a painful death soon after. Since then, i decided never to go with the “better” product, but always to side with the masses. Sometimes it hurts to be practical.

    Yo Mama Uses a Mac

    Sure, i make cracks about Macs just like the next non-Mac-owning guy. “i’m getting a Mac.” “Oh? i could’ve sworn you were straight”, and “Mac is so intuitive! To eject a disk – just drag the icon into the TRASH CAN”, etc etc. i bought into the stereotypes that 1. Macs were for creative (read:gay) people, and 2. that despite the company’s claims that the platform was super-easy to use, it wasn’t.

    Well, it turns out i was actually right on both accounts. i started watching the developer videos for the iPhone SDK, and the parade of “creative” types reminded me of my stint in community theatre. Mac definitely, definitely attracts more gay dudes. As Seinfeld would say, “not that there’s anything wrong with that.”

    My Mac is also nowhere near as easy to use as Apple would have us neophytes believe. You don’t have to spend much time with Xcode, Interface Builder, Keychain, and the iPhone Simulator before your screen is an absolute zoo of windows, modules and toolbars. Not only are the modules not integrated into a single system – within each module, there’s a laundry list of pallettes that float on your desktop and don’t reliably dock to anything, making it completely confusing to understand which program you’re actually working in. Of course, this is just my experience with Xcode, which is free – i haven’t tried any other Apple software, so i’m willing to reserve judgment.

    Too Many Windows on a Mac

    If someone will tell me the Mac equivalent of the Windows-M “minimize all” command, i will marry your ugly cousin and paint your front porch

    Impeccable Attention to Not Bursting into Flames

    Where i’ve been really impressed with my Mac experience is in the hardware department. i have a MacBook – an older model, white Apple laptop – that cost me around $1200 CDN after i bullied FutureShop into matching BestBuy’s Boxing Week price. (Pro tip: they really back down on the warranty they try to sell you when you open up a web browser in their computer department and surf over to the pages and pages of Futureshop bashing on EhMac.ca).

    My first laptop, my only laptop, is a beastly Dell XPS that i used $3k in corporate bursary money to purchase. It dents easily, and plaques and stickers are always falling off of it. It comes armed to the teeth with Dell bloatware, and it heats up to searing, kill-a-baby temperatures. It’s not a good machine at all, despite what CNet reviews would have you believe. (After buying some Dell monitors based on CNet reviews, i slowly came to the realization that Dell must sponsor reviews on the CNet site. i have since sworn off Dell altogether.)

    Dell XPS Bonfire

    My Dell XPS after seven minutes of operation. The “X” stands for “scorching bonfire”.

    Dell must have done their marketing correctly, because people all over the place ask me how i like the XPS laptop – even when they can’t see the logo on the back of it, which mystifies me. It’s weird. It’s kind of like having this disease, and everyone oohs and aahs over it. “Oooh – the mumps! i’ve heard good things! How do you like them?”

    Meanwhile, the MacBook is quiet and happy. The battery life is generous, and seems to outperform the XPS battery by a longshot. It coos at me when i start it up, and it’s gently stroking my thigh as i write this blog post. Something’s a little fishy about that last feature, but i’ll let it slide.

    Drink the Apple-Flavoured Kool-Aid

    One of Apple’s slogans is “Think Different”, and my early iPhone development experience has been just that – different. There’s definitely a different class of people posting on those message boards i posted above. They’re smarter. It’s obvious. These folks are a far cry from the teenagers hacking Flash and tossing out a mountain of free content from their moms’ basements – the Basement Battalion. The Flash community has its champions, but by and large, there’s a lot of desperate-seeming “me-tooism” and people doing their very best to learn Flash Actionscript so they can launch their sequel to Booby-Shooter 5000 on AddictingGames.com.

    i dunno. Maybe i haven’t been around the Apple dev community long enough to have discovered the dregs. But i will say that through all of the Apple dev boards i’ve read, there seems to be this weird devotion to Apple. It unnerves me a little … “Apple” is spoken of with reverence, as if the devs are talking about a benevolent father figure instead of a corporation, who scolds them when they misbehave and who rewards them with technological goodies when they are nice. It’s a teensy bit Big Brother-ish, from an outsider’s perspective. A little cultish. i hope i don’t end up dead in a cot somewhere wearing new Reeboks with a mouthful of Kool-Aid in a bid to join Steve Jobs at the mothership.

    Well … if the mothership is taking me to a planet where the market is crazy for independent games, and small shops are praised as a guiding light in interactive entertainment, i might just take a tiny sip.