Provisioning and Building — iOS

This guide explains how to set up your system and devices in the Apple Developer portal. It also explains how to build your apps for testing or distribution.

Note

If you are on a Non-Apple Computer (i.e Windows or Linux) and want to build for iOS, check this Solar2D tool

Creating Certificates

  1. You must have an Apple Developer account to install/test apps on iOS devices and publish to the App Store. Once registered and logged in, enter the Member Center, navigate to the Certificates, Identifiers & Profiles dashboard, and click on Certificates within the iOS Apps column. Alternatively, if you've already entered the iOS Apps section from another page within the portal, click the All button under Certificates in the left column.

  2. In the upper-right corner, click the [+] button to create a new certificate.

  3. You'll be prompted to choose which type of certificate to create. There are two types which pertain to this guide:

    • DevelopmentiOS App Development — use this during development to test on your own devices.

    • ProductionApp Store and Ad Hoc — use this only for submission to the App Store or to install your app on a limited number of registered devices.

  4. Select the type and click Continue at the bottom. You'll be prompted to generate a new certificate. As indicated in the instructions, open the Keychain Access tool from the ApplicationsUtilities folder.

  5. From the main Keychain Access menu, select Certificate AssistantRequest a Certificate From a Certificate Authority. You will be presented with a form containing the following fields:

    • User Email Address — enter the email address associated with your Apple Developer account.

    • Common Name — enter your name or company/team name.

    • CA Email Address — this field is not required, since you will save the certificate to disk.

    • Request is: — select Saved to disk.

  6. Click Continue and then specify where to save the file (Desktop is fine). This will generate the certificate signing request. Click Done in the next window.

  7. Back in the developer portal, proceed to the next step, titled Generate your certificate. Near the bottom, under Upload CSR file, click the Choose File... button and select the file you just created. Click the Generate button to confirm.

  8. The final step is to download and install the certificate on your local keychain. Follow the instructions provided on the screen.

  9. Back in the Certificates section of the developer portal, the new certificate should appear.

Registering Devices

Some guides begin with creating App IDs, but we recommend that you register your devices first. This will save you the task of modifying and re-downloading the provisioning profiles later.

  1. Connect the device, open Xcode, and then open the Devices window by selecting WindowDevices.

  2. In the left column, select the device. If this is the first time you're using the device for development purposes, you may need to enable it for development by selecting Use device for development in the main pane.

  3. Back in the developer portal, click the All button under Devices in the left column.

  4. In the upper-right corner, click the [+] button to register a new device.

  5. You'll be prompted to register either one device or multiple devices. If you choose the first option, enter the following information:

    • Name — this name is only visible to you and helps to identify the device.

    • UDID — this 40-character hexadecimal value is the Unique Device Identifier for the device. You can locate this by opening the Xcode Devices window, selecting the device in the left column, looking for Identifier in the information panel, right-clicking the value, and selecting Copy.

  6. Click Continue to register the device. Back in the Devices section of the developer portal, the new device should appear.

  7. Repeat this process for all of your additional devices.

Creating App IDs

Next, you must create a new App ID for your Corona app.

  1. In the developer portal, click the App IDs button under Identifiers in the left column.

  2. In the upper-right corner, click the [+] button to create a new App ID.

  3. Fill in the information:

    • App ID Description — only you will see this; it helps you identify the app.

    • App ID Prefix — this should be set to the Team ID that's associated with your developer account.

    • App ID Suffix — this is not visible to consumers, but it must be unique. Apple recommends that you specify the Bundle ID in reverse-domain format, for example com.domainname.myapp.

    • App Services — select the services you would like to enable.

  4. Click Continue. This should lead to a screen where you can confirm the App ID details. Click Submit to complete the creation of the App ID. Back in the App IDs section of the developer portal, the new ID should appear.

Important

Do not specify CFBundleIdentifier in the iphoneplist section of build.settings. Corona will use the ID from the provisioning profile for this purpose.

Note

If you configure an App ID without additional services like Push Notifications, and later add those features to the App ID, you must reinstall the provisioning profile by repeating all of the download and installation steps outlined in the next section. Thus, it's best to select all of the services which you intend to utilize in the app.

Creating Provisioning Profiles

All iOS apps require that you use provisioning profiles during development. You cannot run an app on a device until you provision that device for development.

  1. In the developer portal, click the All button under Provisioning Profiles in the left column.

  2. In the upper-right corner, click the [+] button to create a new provisioning profile.

  3. You'll be prompted to choose which type of provisioning profile to create.

    • Development: iOS App Development — use this during development to test on your own devices.

    • Distribution: App Store — use this only for submission to the App Store.

    • Distribution: Ad Hoc — use this to install your app on a limited number of registered devices.

  4. Select the type you want to create and click Continue. On the next screen, you'll be prompted to select the App ID to associate with the profile. Assuming you've created at least one App ID, select it from the list and click Continue. If you haven't created any App IDs, please see Creating App IDs above.

  5. Next, you must associate at least one certificate with the provisioning profile. Select the appropriate certificate(s) from the list and click Continue. Note that the provisioning profile must be associated with a matching certificate type. For example, if you want to create a provisioning profile for distribution, you must first create a distribution certificate. If no certificates exist for the type of profile you wish to create, the system will prompt you to create one — in this case, please see Creating Certificates above.

  6. Now proceed to the proper section below, since the steps vary for each profile type.

Development

  1. You must associate at least one device with the development provisioning profile. Select the device(s) from the list and click Continue. If you haven't registered any devices, please see Registering Devices above.

  2. On the next screen, you must provide a Profile Name for the provisioning profile. This will be used to identify the profile in the developer portal. Also, confirm the settings that you made in the previous steps. When you're ready, click Generate to create the profile.

  3. Next, download and install the provisioning profile (click the Download button and then double-click the file).

  4. Back in the developer portal, click Done. The new profile should appear in the list, marked as Active in the Status column.

  5. Now you must install the profile on each device that you selected during the profile creation. Connect the device to your computer and Sync it from within iTunes. When it's done, open the Xcode Devices window, right-click the device image in the left column, and select Show Provisioning Profiles... from the contextual menu. The new profile should appear in the list.

  6. Finally, to associate the new profile with Corona, restart the Corona Simulator. The profile should appear as a Code Signing Identity in the build window. See Build Process below for more details.

Distribution: App Store

  1. You must provide a Profile Name for the provisioning profile. This will be used to identify the profile in the developer portal. Also, confirm the settings that you made in the previous steps. When you're ready, click Generate to create the profile.

  2. Next, download and install the provisioning profile (click the Download button and then double-click the file).

  3. Back in the developer portal, click Done. The new profile should appear in the list, marked as Active in the Status column.

  4. Finally, to associate the new profile with Corona, restart the Corona Simulator. The profile should appear as a Code Signing Identity in the build window. See Build Process below for more details.

Distribution: Ad Hoc

  1. You must associate at least one device with the ad hoc provisioning profile. Select the device(s) from the list and click Continue. If you haven't registered any devices, please see Registering Devices above.

  2. On the next screen, you must provide a Profile Name for the provisioning profile. This will be used to identify the profile in the developer portal. Also, confirm the settings that you made in the previous steps. When you're ready, click Generate to create the profile.

  3. Next, download and install the provisioning profile (click the Download button and then double-click the file).

  4. Back in the developer portal, click Done. The new profile should appear in the list, marked as Active in the Status column.

  5. Now you must install the profile on each device that you selected during the profile creation. Connect the device to your computer and Sync it from within iTunes. When it's done, open the Xcode Devices window, right-click the device image in the left column, and select Show Provisioning Profiles... from the contextual menu. The new profile should appear in the list.

  6. Finally, to associate the new profile with Corona, restart the Corona Simulator. The profile should appear as a Code Signing Identity in the build window. See Build Process below for more details.

Build Process

Important

If you aren't familiar with the available build settings for an app, please review them before proceeding with this section.

Building your app is a simple process once you have your certificate and provisioning profiles installed. You can build your application for testing in the Xcode iOS Simulator or on a device.

  1. From the Corona Simulator, select FileOpen... to load the project you wish to build.

  2. Select FileBuildiOS...

  3. Fill in the information:

    • Application Name — by default, this will match your project folder; keep this name or specify another.

    • Version — specify a version name for your app.

    • Supported Devices — select either iPhone + iPad (Universal), iPhone only, or iPad only depending on your target device(s).

    • Provisioning Profile — select the appropriate provisioning profile for either development or distribution.

    • iOS SDK — select the version of iOS to build for.

    • Save to Folder — specify where to save the compiled app.

    • After Build — select which action should be performed after the app is successfully built.

    • Create Live Build — check this box to create a live build for lightning-fast testing. See Generating Live Builds for details.

  4. Click Build and Corona will compile the app. You will then have an application file that can be loaded on a device or submitted to the App Store, depending on which provisioning profile you selected.

Device Installation

There are three methods to install an app on an iOS device, as outlined below.

You can not test an app built for App Store Distribution on a device. Apps built for distribution are intended for submission to Apple.

Copy to Device

  1. Connect your device.

  2. Follow the steps outlined in Build Process above, ensuring that you select Copy to device for the After Build option.

Xcode

  1. Connect your device, open Xcode, and then open the Devices window by selecting WindowDevices.

  2. In the left column, select the device.

  3. In the main pane, look for the Installed Apps section which shows the currently installed apps (this list may be empty initially). Below the list, click the [+] button and navigate to the location of the .app file which was generated by Corona. Select the file and click Open. Assuming there are no provisioning/certificate errors, the app should install on the device.

iTunes

  1. Connect your device and ensure that iTunes is open.

  2. Select FileAdd to Library... (⌘-O) and navigate to the .app file that was generated by Corona. Alternatively, drag the file over the iTunes dock icon and release.

  3. The view should change to the device's info screen and show all installed apps. Confirm that your app is listed in the Apps menu on the left.

  4. Sync the device and the app should install. Note that iTunes can be particular about app versions — if you repeatedly test new versions of your app, you should remove the previous version from the device before installing the new version. This will ensure that the most current version is installed.

Refreshing Profiles

On occasion, you may need to refresh the provisioning profiles via Xcode. This can be accomplished as follows:

  1. In Xcode, open the Preferences window by selecting XcodePreferences....

  2. Select Accounts from the upper tab bar.

  3. Select the desired account under Apple IDs in the left pane.

  4. In the lower-right section, click the View Details... button.

  5. A panel should open, showing the associated provisioning profiles. In the lower-right section of this panel, click on the small "refresh" button.

  6. Quit and restart both Xcode and the Corona Simulator and proceed with the build process.