Using Quorum on Apple iOS Devices

The Quorum programming language also allows programs to be created within Quorum Studio and to be deployed onto iOS devices. This feature is largely experimental, but shows proof of concept and allows for many basic functions to work on the device. In this tutorial, we demonstrate how to put programs on an iPhone. The procedures are similar for other iOS devices. Note that this only works on Apple hardware at this time, as is typical for iOS programming. To put Quorum programs onto a real device, you will need to follow the steps on signing below. Signing is not necessary if you will only be running the program in the iOS Simulator.

Prerequisites

Before putting Quorum programs onto iOS devices, there are a few things needed in addition to the regular tools for Quorum:

  • A Mac. iOS programs can only be built on Apple hardware.
  • Xcode, Apple's development environment, from the Mac App Store. Open it once after installing it, so it can finish setting itself up.
  • For the iOS Simulator: nothing more. If the simulator isn't installed, Quorum Studio offers to download it the first time you send a program to iOS.
  • For a real iPhone or iPad: an Apple ID, and a USB cable that carries data, not only power. Quorum Studio finds devices through the cable, not over Wi-Fi.

Writing the Quorum Program

Once everything is ready, the first step is to write the Quorum program. The program needs to use the Game class to work properly on iOS devices. For this tutorial, we will make a new Quorum project using the "Game Application" template, however, you could use any existing Quorum game project. You can find complete steps to making a new Quorum project in the Getting Started with Quorum tutorial.

Running Quorum on an iOS device

To run Quorum on a physical device, there are several steps we need to go through. First, we need Xcode, Apple's development environment. We need it because Apple requires special certificates to run a program on our physical devices. These have to be set up before running our program, or the program will fail after a lengthy compile on the Quorum side.

Using Xcode to Set Up a Development Profile

This tutorial will use a free development profile, using an Apple ID. Note that you won’t be able to distribute the app remotely or submit it to the App Store with this free profile; you will need to get a paid developer’s license from Apple for that. To set up your free profile, open Xcode. In the Xcode menu, choose Settings, or press Cmd+,. Choose the Accounts tab in the Settings window. In the bottom-left corner there is a button marked with a plus symbol. Activate the button and select "Apple ID". The window that appears will ask you to sign in with your Apple ID. Enter your account information and then select "Sign In". If you don’t have an Apple ID, you can select "Create Apple ID" to set one up, or you can create one for free at appleid.apple.com. Once signed in, the Accounts tab should look like this:

The Account With User.

If your Apple ID is not already selected in the column on the left, select it now. Then use the "Manage Certificates" button in the bottom right corner of the window. This will open a new window that will allow you to create a signing identity to use for your developer profile.

The Signing Certificates.

In the bottom left hand corner, select the "plus (+)" button. A menu with "Apple Development" appears. Choose it to create your signing certificate. If successful, the name of your Mac appears under "Apple Development Certificates." Choose "Done" to return to the Settings window.

The Apple Development Certificates.

Although the account is now set up in Xcode, we still need to create a provisioning profile for the program. A provisioning profile is an identifier that is made for a single iOS program. It’s used to show who developed it, and that it hasn’t been changed. To create a provisioning profile, we’ll need to use Xcode to make a dummy iOS project. Although this won’t be used as part of the final program, making a project in Xcode will let us create the provisioning profile, as well as test to make sure we can connect to the iOS device. In Xcode, navigate to File > New > Project (or use the hotkey SHIFT-COMMAND-N).

The window for xcode when there is no project open.

Next you need to choose a template to create an iOS app project. This will be a dummy project so no specific template is needed so the "App" template will suffice.

The Xcode new project dialog window where you can choose a dialog and the App template is selected.

Give your project a name and an organization identifier. Xcode joins them into the app's bundle identifier, which has to be unique: once one Apple ID has used an identifier, nobody else can. So choose one of your own, such as org.quorumlanguage.yourname as the organization identifier with a project named MyGame, which makes org.quorumlanguage.yourname.MyGame. Write the full bundle identifier down: the same one goes into Quorum Studio later.

The Xcode Project Options with MyBlankApplication in the Product Name field and org.quorumlanguage in the Organization identifier field.

You can put the Xcode project anywhere convenient on your system. Once you have selected a location, the project should be created and the main Xcode window will open.

Go to the Signing and Capabilities section of the application and tell it to automatically manage signing. You can reach this by selecting the project's root folder in the project navigator, then choosing the Signing and Capabilities tab. For Team, choose your Apple ID's team; with a free Apple ID it is called your Personal Team. Check that the Bundle Identifier shown there is the one you wrote down.

The Xcode Project open to the signing and capabilites section. and the Bundle Identifier field is selected and org.quourmlanguage is in the field.

An external reference on these certificates can be found on the iOS Code Signing website.

Running the Dummy Xcode Project

Now, we can test the dummy Xcode application on the device. This step makes the provisioning profile, and checks that you can place an app on your device. First, connect the device to the Mac with a USB data cable and unlock it. If the device asks whether to trust this computer, choose Trust.

Recent versions of iOS also need Developer Mode turned on before they run apps from Xcode. On the device, open Settings, then Privacy and Security, then Developer Mode, and turn it on. The device restarts and asks you to confirm.

In Xcode, choose your device as the run destination at the top of the window. Then choose the Run button, select Run from the Product menu, or press Cmd+R. The dummy Xcode project should install itself on the device and launch. Xcode may prompt you to unlock your device to complete installation.

If the program runs without issue, you can skip to the next section. However, you may receive a message that your program could not be launched because the developer is not trusted on the device. If this happens, open Settings on your device, then General, then VPN and Device Management. Under Developer App, choose your Apple Development certificate, then choose Trust and confirm. The app should then run. This is needed once for each certificate.

When you run the app, it should do nothing but open a blank screen. This is because that’s all the templated project we made in Xcode is meant to do. You have now confirmed that the development environment is set up to put apps on the device.

With a free Apple ID, a provisioning profile lasts seven days. When it runs out, Quorum Studio can no longer sign your program for the device. To make a new one, open the dummy Xcode project and run it on the device again. A free Apple ID can also create only ten new bundle identifiers in seven days, so reusing one identifier while you test is easier.

Running the Quorum Project on your Device

Open the Quorum project in Quorum Studio.

Either use your existing Game project or create a new one using a template. Here we will make one using the Game Template.

Quorum Studio open with the new project template dialog open with the Game template selected

Open the project properties: select the project's name, then choose Edit Project Properties from the "Edit" menu, or press Cmd+P. You can also open the project's context menu and choose Properties.

Quorum Studio with the Project Dropdown open and the Properties selection highlighted.

Go to the Apple tab. In the Bundle Identifier field, enter exactly the bundle identifier you wrote down in Xcode. New Quorum projects start with org.quorumlanguage, which won't work on a device, because that identifier belongs to one Apple ID.

The Signing Identity and Provisioning Profile fields can stay empty. Quorum Studio then finds the certificate and provisioning profile Xcode made, by matching the bundle identifier. Fill them in only to choose a particular certificate or profile.

Screenshot of the Apple Device Settings window in Quorum Studio with example iOS configuration fields.

Select the device you want in the Device List on the Apple tab. A device plugged in after Quorum Studio starts may not be listed until you restart Quorum Studio, as it checks for connected devices when it starts. Simulators are always listed. If you leave the simulator choice to Quorum Studio, it picks one for you.

Quorum Studio with the Project Properties Dialog open on the Apple tab. The bundle field reads org.quorumlanguage and an iPhone simulator is selected in the device list.

Once the properties are filled in, select "OK". You are ready to build the Quorum project.

To build the project for iOS, choose Send to iOS from the Run menu, or press Cmd+Shift+I. Before building, Quorum Studio checks that Xcode is ready, and says what to do if it isn't. For the simulator, it offers to download the iOS Simulator if it isn't installed.

If the device says the developer is untrusted, open Settings on the device, then General, then VPN and Device Management. Under Developer App, choose your Apple Development certificate, then choose Trust and confirm. Then send the program to iOS again.

Quorum Studio with the Run Menu bar item open and Send to iOS is selected

Compilation will take a while, especially the first time, so be patient. Here is an example of a project running on the iOS simulator:

The window of the iOS simulator running a Quorum Game with a Blue box and a green floor

Known Issues

If the device is connected over Wi-Fi rather than a cable, the program may not reach it, even though the build says it succeeded. Connect the device with a USB data cable and send it again.

If the build stops because no provisioning profile matches the bundle identifier, the profile has probably run out, or the bundle identifiers in Xcode and Quorum Studio differ. Check that they match, then run the dummy Xcode project on the device again to make a new profile.

Quorum Studio needs Xcode's own command line tools. If your Mac is set to use the separate Command Line Tools instead, Quorum Studio says so when you send to iOS, and the device list may be empty. To fix this, set the command line tools back to Xcode's with the command sudo xcode-select --reset

To verify the command line tools are correct you can run xcode-select -p and the result should be /Applications/Xcode.app/Contents/Developer