Unity Cloud Build helps you automate the process of building your Unity Project for iOS devices.
This article describes the prerequisites necessary to build your Project for iOS and how to create the supporting components to configure Cloud Build. Topics covered include:
To develop iOS apps, you must be a member of the iOS Developer Program. The cost is currently $99 per year, and allows you to build, test, and eventually release your apps in the Apple App Store.
Note: You must have an Intel-based Mac running OS X Yosemite (v10.10) or later to develop and distribute iOS apps and Mac apps.
To join the iOS Developer program:
Log in to the Apple Developer Program page.
Important: Use the Safari browser. You might encounter issues if you use the Chrome or Firefox browsers.
Click the Enroll button.
Read the information on the What You Need To Enroll page and then click the Start Your Enrollment button.
Log in with your Apple ID, or create a new Apple ID if you don’t have one
Enter your contact information and any requested business information.
Read the license agreement. If you agree to the terms, check the acceptance checkbox and click the Continue button.
Purchase the program
Note: You cannot access the Apple Developer Program until your membership has been approved. Apple typically takes around 24 hours to approve your membership.
Activate the Program
After you sign in to the Apple Program Developer portal, you’ll see a list labeled Program Resources on the left. Click Certificates, IDs & Profiles to manage the certificates, identifiers, profiles, and devices you need to develop and distribute apps.
A provisioning profile ties developers and devices to an authorized Development Team and enables you to use a device for testing. You must install a Development Provisioning Profile on each device on which you plan to run your application code.
Each Development Provisioning Profile contains a set of Development Certificates, Unique Device Identifiers (UDID) and an App ID.
To use a device for testing, you must also include your Development Certificate in the profile. A single device can contain multiple provisioning profiles.
Certificates determine whether your app is development-only or a release candidate for the App Store. You should use an Ad Hoc Production Certificate so that you can test all the features of your game (like GameCenter, etc).
Identifiers are the unique IDs that you use to identify your project. For basic projects, or if this is your first iOS project, you’ll probably want to make an App ID. This is often the same as your Unity3D Project’s Bundle ID.
Tip: For more information on signing identities and certificates, see Maintaining Your Signing Identities and Certificates on the Apple developer website.
Devices are the hardware, such as an iPhone, iPad, or iPod on which you plan to test your project. You must retrieve the UDID for each device on which you plan to test your game. You then add the UDID to the Devices section in the iOS developer portal.
Note: Each year, you’re allowed to register a fixed number of devices. The maximum number of devices you can register is 100 devices per product family per membership year. For more information see, Registering Devices Using Your Developer Account in the Maintaining Identifiers, Devices, and Profiles topic on the Apple developer website.
When you create a certificate, you must decide whether to create a Development Certificate (used only for testing), or a Production Certificate, which you use to distribute your app via the App Store.
Tip: Create a Production Certificate. While either certificate type works for development, using a Production certificate makes the process of releasing your app to the Apple store easier.
To add the certificate to a keychain, locate the certificate file and double-click it. This opens the Keychain Access program. If you get a popup with the message “Do you want to add the certificate to a keychain?”, choose login and click the Add button.
To create apps using Unity Cloud Build, you must convert your certificate file to a p12 file. A p12 file is a file that contains your private key and certificate and is used to sign your code. Typically, if you are developing a project in native Xcode, this process is handled for you behind the scenes.
To generate a p12 file:
On your Mac, open up your Finder and in Applications/Utilities, open the Keychain Access program.
In the left-hand column, under keychains verify that Login is selected.
In the left-hand column, under Category verify that My Certificates is selected. In the main Keychain Access pane, select your certificate.
Note: Typically your certificate is located under My Certificates. If you do not find it there, check under Certificates.
From the File menu, select File > Export Items, or right-click and select Export.
Select Personal Information Exchange (.p12) from the File Format drop-down menu.
Note: If Login under Keychains and My Certificates under Category is not selected, the p12 option is greyed out.
You are asked to create a password for the p12 file.
Important: Record the password somewhere safe. You must supply the password when setting up iOS builds on Unity Cloud Build.
Apple requires the UDID for each device on which you intend to install your app. This is only required for development purposes. Once your app is accepted into the App Store, it is available for anyone to download and install; provided they have the correct version of iOS and meet any other necessary requirements.
You can use iTunes to retrieve the UDID of your device. For a thorough walkthrough of the retrieval process, see WhatsMyUDID.com.
The basic steps are:
Now that you have your device UDID(s), you’re ready to add them to the Apple Developer Portal:
Repeat the steps for each of your devices.
Now that you’ve created your iOS Certificate, you can create an App ID which is used to create an App ID:
In the left-hand column of the Apple Developer Portal, click App ID.
In the Register iOS App IDs pane, at the top right, click the Add button (+).
For more information on registering an App ID, see Maintaining Identifiers, Devices, and Profiles.
Click the Continue button.
On the Confirm your App ID page, check the information you’ve provided and then click the Submit button.
The next step is to generate a .mobileprovision file. The .mobileprovision file combines your p12 certificate, App ID, and identifies the UDIDs of the devices on which you are testing your app.
Download the generated .mobileprovision file to your desktop machine.
To configure your iOS Cloud Build, you need the following items:
For basic iOS usage this process should be sufficient. For projects that include Xcode frameworks, you must perform some additional configuration.
To add Xcode frameworks manually, use the Xcode Manipulation API. The API is maintained by the Unity iOS team and API allows you to manage external Xcode frameworks.
For an example of a Unity Project that uses the API, see the UpdateXcodeProject example Project on BitBucket. You can use the example to experiment and to learn from.
One of the plugins of the example Project is an external Xcode project manipulation DLL. The DLL is the build product of the source available in Unity’s Bitbucket repository. A preferred way to include Xcode project manipulation functionality is to copy the C# source code files to the Assets/Editor folder in your Project.
There are two ways you can use the Xcode Manipulation API: