Skip to content

Install and run tvOS project on AppleTV using Xcode

devsena edited this page Dec 8, 2022 · 5 revisions

Prerequisites

  • Xcode
  • Apple Developer Account (should enable with "Certificates, Identifiers & Profiles")
  • GBAuth

Profile and identifiers

This requires you to log into https://developer.apple.com with your Apple Developer account, and provide/ensure following development/debug details are present.

Device ID

Debug/install to device(AppleTV) requires the device UDID to be added in your Apple Developer Account.

To ensure you have your device UDID properly added, click on the "Devices" link from "Certificates, Identifiers & Profiles" category:

image

Devices is the list of the devices which you can use during your development/tests. With a standard subscription, one can add upto 13 devices at a time.

If you device is not already listed, you can add one by clicking on the +(plus-icon) button in the section with relevant details: image

UDID unique device identifier of 40-digit hexa-decimal characters'. To get your AppleTV device UDID,

  1. Make sure your AppleTV is connected to your Mac using USB-C, and turned On
  2. Open Xcode
  3. Go to menu Window > Devices and Simulators

If your device properly connected, Xcode should display it.

image

You can copy the Identifier value from above window and create a new Device at Apple Developer Account.

Identifiers

Identifiers under "Certificates, Identifiers & Profiles" at Apple Developer Center is another area we need to ensure. This section holds all the app-identifiers (full or wild-card) that you can use during your development/debug tests, to a device.

You can add an app-identifier in wild-card way, i.e. com.mycompany.*, or you can name it specifically, i.e. com.mycompany.myapp.

SystemHealthAlerts-tvOS app uses net.prominic.SystemHealthAlerts. You generally need not to adds this manually, but Xcode do it for you.

If you still see following error under Xcode project's "Signing & Capabilities" section, consider to check if you can add the identifier manually by going into Identifiers under "Certificates, Identifiers & Profiles" (a):

image

For now, let's move to the next section.

Setup Xcode

Open Finder and navigate to the SystemHealthAlerts-tvOS source directory.

Double-click on the SystemHealthAlerts.xcworkspace file:

image

This should open you the project in Xcode.

Now we connect Xcode to your Apple Developer Account so Xcode can automatically retrieve necessary provisioning, identifiers from the website. To do that,

  • Click on the menu Xcode > Settings
  • Go to Accounts tab
  • Click on + icon at bottom-left corner and choose "Apple ID" in opening popup

Follow the instruction and login to your Apple Developer Account to make Xcode connect and retrieve necessary details.

Once login complete, you should see the window updates with your login information, i.e.

image

Double-click on the Prominic.NET,Inc / Admin entry, this should open you a new popup with available certificate details like this:

image

We're possibly good at this point. Close all the popup windows and go to the next section.

Run/Install on device

Make sure GBAuth is running and you have access to System Dashboard.

Back to Xcode, click on the root node of SystemHealthAlerts project in the sidebar. This shall open you the project's settings tab. Click on the "Signing & Capabilities" tab.

image

  • Make sure Automatically manage signing option is selected
  • In the Team dropdown select your developer account that you connected earlier

If no error shown after the above steps, we're good to go. If you see an error like (a), you need to create an identifier as mentioned earlier.

At this point, we're ready to install/debug SystemHealthAlerts on the connected AppleTV device:

  • Click on the area in Xcode's top-status-bar where the call-out creates, and choose your device under "tvOS Device" head

image

  • You can also select any option under "tvOS Simulators" from the opening call-out, to run on your computer simulator
  • Having your AppleTV device selected as output platform, go to menu Product > Run or CMD+R

If all's good, you'll eventually see the app installs and run/debug on your AppleTV.

To stop the build/run, click on the stop-icon or choose from menu Product > Stop:

image