10 min read

In this article by Michelle M. Fernandez, author of the book Corona SDK Mobile Game Development Beginner’s Guide, we can upload our first Hello World application on an iOS device, we need to log in into our Apple developer account so that we can create and install our signing certificates on our development machine. If you haven’t created a developer account yet, do so by going to http://developer.apple.com/programs/ios/. Remember that there is a fee of $99 a year to become an Apple developer.

(For more resources related to this topic, see here.)

The Apple developer account is only applied to users developing on Mac OS X. Make sure that your version of Xcode is the same or newer than the version of the OS on your phone. For example, if you have version 5.0 of the iPhone OS installed, you will need Xcode that is bundled with the iOS SDK version 5.0 or later.

Time for action – obtaining the iOS developer certificate

Make sure that you’re signed up for the developer program; you will need to use the Keychain Access tool located in /Applications/Utilities so that you can create a certificate request. A valid certificate must sign all iOS applications before they can be run on an Apple device in order to do any kind of testing. The following steps will show you how to create an iOS developer certificate:

  1. Go to Keychain Access | Certificate Assistant | Request a Certificate From a Certificate Authority:
    Corona SDK Mobile Game Development: Beginner's Guide - Second Edition
  2. In the User Email Address field, type in the e-mail address you used when you registered as an iOS developer. For Common Name, enter your name or team name. Make sure that the name entered matches the information that was submitted when you registered as an iOS developer. The CA Email Address field does not need to be filled in, so you can leave it blank. We are not e-mailing the certificate to a Certificate Authority (CA). Check Saved to disk and Let me specify key pair information. When you click on Continue, you will be asked to choose a save location. Save your file at a destination where you can locate it easily, such as your desktop.
    Corona SDK Mobile Game Development: Beginner's Guide - Second Edition
  3. In the following window, make sure that 2048 bits is selected for the Key Size and RSA for the Algorithm, and then click on Continue. This will generate the key and save it to the location you specified. Click on Done in the next window.
    Corona SDK Mobile Game Development: Beginner's Guide - Second Edition
  4. Next, go to the Apple developer website at http://developer.apple.com/, click on iOS Dev Center, and log in to your developer account. Select Certificates, Identifiers & Profiles under iOS Developer Program on the right-hand side of the screen and navigate to Certificates under iOS Apps. Select the + icon on the right-hand side of the page. Under Development, click on the iOS App Development radio button. Click on the Continue button till you reach the screen to generate your certificate:
    Corona SDK Mobile Game Development: Beginner's Guide - Second Edition
  5. Click on the Choose File button and locate your certificate file that you saved to your desktop, and then, click on the Generate button.
  6. Upon hitting Generate, you will get the e-mail notification you specified in the CA request form from Keychain Access, or you can download it directly from the developer portal. The person who created the certificate will get this e-mail and can approve the request by hitting the Approve button.
    Corona SDK Mobile Game Development: Beginner's Guide - Second Edition
  7. Click on the Download button and save the certificate to a location that is easy to find. Once this is completed, double-click on the file, and the certificate will be added automatically in the Keychain Access.
    Corona SDK Mobile Game Development: Beginner's Guide - Second Edition

What just happened?

We now have a valid certificate for iOS devices. The iOS Development Certificate is used for development purposes only and valid for about a year. The key pair is made up of your public and private keys. The private key is what allows Xcode to sign iOS applications. Private keys are available only to the key pair creator and are stored in the system keychain of the creator’s machine.

Adding iOS devices

You are allowed to assign up to 100 devices for development and testing purposes in the iPhone Developer Program. To register a device, you will need the Unique Device Identification (UDID) number. You can find this in iTunes and Xcode.

Xcode

To find out your device’s UDID, connect your device to your Mac and open Xcode. In Xcode, navigate to the menu bar, select Window, and then click on Organizer. The 40 hex character string in the Identifier field is your device’s UDID. Once the Organizer window is open, you should see the name of your device in the Devices list on the left-hand side. Click on it and select the identifier with your mouse, copying it to the clipboard.

Corona SDK Mobile Game Development: Beginner's Guide - Second Edition

Usually, when you connect a device to Organizer for the first time, you’ll receive a button notification that says Use for Development. Select it and Xcode will do most of the provisioning work for your device in the iOS Provisioning Portal.

iTunes

With your device connected, open iTunes and click on your device in the device list. Select the Summary tab. Click on the Serial Number label to show the Identifier field and the 40-character UDID. Press Command + C to copy the UDID to your clipboard.

Corona SDK Mobile Game Development: Beginner's Guide - Second Edition

Time for action – adding/registering your iOS device

To add a device to use for development/testing, perform the following steps:

  1. Select Devices in the Developer Portal and click on the + icon to register a new device. Select the Register Device radio button to register one device.
  2. Create a name for your device in the Name field and put your device’s UDID in the UDID field by pressing Command + V to paste the number you have saved on the clipboard.
  3. Click on Continue when you are done and click on Register once you have verified the device information.
    Corona SDK Mobile Game Development: Beginner's Guide - Second Edition

Time for action – creating an App ID

Now that you have added a device to the portal, you will need to create an App ID. An App ID has a unique 10-character Apple ID Prefix generated by Apple and an Apple ID Suffix that is created by the Team Admin in the Provisioning Portal. An App ID could looks like this: 7R456G1254.com.companyname.YourApplication. To create a new App ID, use these steps:

  1. Click on App IDs in the Identifiers section of the portal and select the + icon.
    Corona SDK Mobile Game Development: Beginner's Guide - Second Edition
  2. Fill out the App ID Description field with the name of your application.
  3. You are already assigned an Apple ID Prefix (also known as a Team ID).
  4. In the App ID Suffix field, specify a unique identifier for your app. It is up to you how you want to identify your app, but it is recommended that you use the reverse-domain style string, that is, com.domainname.appname. Click on Continue and then on Submit to create your App ID.

    You can create a wildcard character in the bundle identifier that you can share among a suite of applications using the same Keychain access. To do this, simply create a single App ID with an asterisk (*) at the end. You would place this in the field for the bundle identifier either by itself or at the end of your string, for example, com.domainname.*. More information on this topic can be found in the App IDs section of the iOS Provisioning Portal at https://developer.apple.com/ios/manage/bundles/howto.action.

What just happened?

All UDIDs are unique on every device, and we can locate them in Xcode and iTunes. When we added a device in the iOS Provisioning Portal, we took the UDID, which consists of 40 hex characters, and made sure we created a device name so that we could identify what we’re using for development.

We now have an App ID for the applications we want to install on a device. An App ID is a unique identifier that iOS uses to allow your application to connect to the Apple Push Notification service, share keychain data between applications, and communicate with external hardware accessories you wish to pair your iOS application with.

Provisioning profiles

A provisioning profile is a collection of digital entities that uniquely ties apps and devices to an authorized iOS Development Team and enables a device to be used to test a particular app. Provisioning profiles define the relationship between apps, devices, and development teams. They need to be defined for both the development and distribution aspects of an app.

Time for action – creating a provisioning profile

To create a provisioning profile, go to the Provisioning Profiles section of the Developer Portal and click on the + icon. Perform the following steps:

  1. Select the iOS App Development radio button under the Development section and then select Continue.
  2. Select the App ID you created for your application in the pull-down menu and click on Continue.
  3. Select the certificate you wish to include in the provisioning profile and then click on Continue.
  4. Select the devices you wish to authorize for this profile and click on Continue.
  5. Create a Profile Name and click on the Generate button when you are done:
    Corona SDK Mobile Game Development: Beginner's Guide - Second Edition
  6. Click on the Download button. While the file is downloading, launch Xcode if it’s not already open and press Shift + Command + 2 on the keyboard to open Organizer.
  7. Under Library, select the Provisioning Profiles section. Drag your downloaded .mobileprovision file to the Organizer window. This will automatically copy your .mobileprovision file to the proper directory.
    Corona SDK Mobile Game Development: Beginner's Guide - Second Edition

What just happened?

Devices that have permission within the provisioning profile can be used for testing as long as the certificates are included in the profile. One device can have multiple provisioning profiles installed.

Application icon

Currently, our app has no icon image to display on the device. By default, if there is no icon image set for the application, you will see a light gray box displayed along with your application name below it once the build has been loaded to your device. So, launch your preferred creative developmental tool and let’s create a simple image.

The application icon for standard resolution iPad2 or iPad mini image file is 76 x 76 px PNG. The image should always be saved as Icon.png and must be located in your current project folder. iPhone/iPod touch devices that support retina display need an additional high resolution 120 x 120 px and iPad or iPad mini have an icon of 152 x 152 px named as [email protected].

The contents of your current project folder should look like this:

Hello World/       name of your project folder
Icon.png           required for iPhone/iPod/iPad
[email protected]   required for iPhone/iPod with Retina display
main.lua

In order to distribute your app, the App Store requires a 1024 x 1024 pixel version of the icon. It is best to create your icon at a higher resolution first. Refer to the Apple iOS Human Interface Guidelines for the latest official App Store requirements at http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/Introduction/Introduction.html.

Creating an application icon is a visual representation of your application name. You will be able to view the icon on your device once you compile a build together. The icon is also the image that launches your application.

Summary

In this article, we covered how to test your app on an iOS device and register your iOS device.

Resources for Article:


Further resources on this subject:


LEAVE A REPLY

Please enter your comment!
Please enter your name here