Tag Archives: iPod

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:

    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.

    Request

  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.

    Hooray!

    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!