Book Image

Flash iOS Apps Cookbook

By : Christopher Caleb
Book Image

Flash iOS Apps Cookbook

By: Christopher Caleb

Overview of this book

The latest version of Flash Professional can directly target iOS, allowing Flash developers to write applications that will run natively on Apple's iPhone, iPad, and iPod touch. What's more, with Apple loosening its restrictions on third-party technologies, apps written in Flash can now be sold and distributed within the App Store.Flash iOS Apps Cookbook provides the recipes required to build native iOS apps using your existing knowledge of the Flash platform. Whether you want to create something new or simply convert an existing Flash project, the relevant steps and techniques will be covered, helping you achieve your goal.Learn how to configure and use Flash Professional for iOS development by writing and deploying a simple app to a device. Implement many iOS-specific features such a multi-touch, the virtual keyboard, camera support, screen orientation and the Retina display. Overcome the limitations of mobile development by mastering hardware acceleration and optimization. Whether you're an enthusiast or professional developer, the Flash iOS Apps Cookbook is your toolkit to creating high-quality content for iPhone, iPad and iPod touch.
Table of Contents (21 chapters)
Flash iOS Apps Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a P12 certificate using Windows


Now that you have downloaded your development certificate from the Provisioning Portal, the final step is to convert it to a P12 certificate file.

Flash Professional will use this P12 file to digitally sign any iOS apps you create.

The process for generating a P12 certificate file differs depending on your choice of operating system.

The steps for Microsoft Windows are covered in this recipe. If you are using Mac OS X, then refer to the Creating a P12 certificate using Mac OS X recipe.

Getting ready

You will need the development certificate that you created and downloaded from the iOS Provisioning Portal. If you haven't already done this, then follow the steps outlined in the Obtaining your development certificate recipe.

How to do it...

As was the case when creating a CSR, you will need to use OpenSSL to convert your development certificate into a P12 file by executing the following steps:

  1. Open a command session in Windows as the administrator.

  2. Move to OpenSSL's bin folder by entering the following command into the command prompt:

    cd C:\OpenSSL-Win32\bin
    
  3. The first step is to convert your development certificate file into a PEM certificate file by entering the following command line statement:

    openssl x509 -in developer_identity.cer -inform DER -out developer_identity.pem -outform PEM
    

    For this to work you will need to save the developer_identity.cer file, that you downloaded from the Provisioning Portal to OpenSSL's bin folder.

  4. Now using the PEM file and your private key, generate a valid P12 file by entering:

    set RANDFILE=.rnd
    

    followed by:

    openssl pkcs12 -export -inkey mykey.key -in developer_identity.pem -out ios_dev.p12
    
  5. During this process, OpenSSL will ask you to specify an export password. Flash Professional will prompt you for this password while compiling your .swf files into native iOS apps, so choose something you aren't likely to forget. Enter your password and confirm it when OpenSSL asks you to verify it.

    Note

    When entering the password it may look like the command line isn't responding to your keystrokes. Don't worry, your keys are being registered but for security reasons aren't being echoed to the screen.

  6. If successful, an ios_dev.p12 file will be created in the bin folder. It is important that you keep this file safe as you will need it to publish any of the examples in this book.

  7. Using Windows Explorer, navigate to your Documents folder and create the following folder structure within it: packt\flash-ios-cookbook\developer-files\. This is where we will keep our P12 certificate file from now on.

    Note

    The location of your Documents folder depends on the version of Windows you are running. For Windows Vista and Windows 7, it can be found at: C:\Users\<username>\Documents\. If you are using Windows XP, then it is at: C:\Documents and Settings\<username>\My Documents\.

  8. Copy ios_dev.p12 from C:\OpenSSL-Win32\bin\ to the developer-files folder you just created.

How it works...

When publishing iOS apps from Flash Professional, you will be prompted for your P12 certificate file and password. Both are used to digitally sign your app allowing it to be deployed and tested on an iOS device.

The P12 certificate is the first of the two files that will be used by Flash Professional every time you make an iOS build.

Tip

Testing without a device

If you decide to test from the AIR Debug Launcher (ADL) rather than deploying to an iOS device, then a P12 certificate file isn't required.

There's more...

Finally, a few additional words regarding certificates.

Certificate expiration

When your developer certificate eventually expires, you will need to request a new one from the Provisioning Portal before converting it to a P12 file. Any apps that were published using the old certificate will no longer run on your iOS device and will need to be republished using a new valid P12 file.

If you accidentally delete your existing P12 file, then you can simply recreate it from the steps outlined in this recipe. There is no need to request a new development certificate from the Provisioning Portal.