AIR SDK now supports building applications for Apple TV (tvOS v9.2 or later) in BETA quality. With the following modifications, most of the existing content in your AIR application works seamlessly on tvOS (Apple TV 4th generation and later).

  1. To create a package for tvOS, the developers need to provide a valid provisioning profile for tvOS. This provisioning profile is different from the one that is used for iOS. The packaging command and the targets to be used for packaging tvOS applications remain the same as that for iOS. Refer to these resources for more details: Exporting Your App for Testing (iOS, tvOS, watchOS)Maintaining Identifiers, Devices, and Profiles, and App Programming Guide for tvOS.

  2. Developers must provide a UIDeviceFamily value of 3 in the application descriptor for the tvOS platform. However, if this value is not provided and tvOS provisioning is given in packaging, then the UIDeviceFamily value equal to 3 is added automatically in the final IPA that is generated.
<iPhone>
    <InfoAdditions><![CDATA[
        <key>UIDeviceFamily</key>
        <array>
            <string>3</string>
        </array>
    ]]></InfoAdditions>
</iPhone>

Following warnings appear if there is a mismatch between the provisioning profile and the UIDeviceFamily value:

  • Warning: Provisioning profile specified for tvOS, ignoring iOS UIDeviceFamily value(s).
  • Warning: Provisioning profile specified for iOS, ignoring tvOS UIDeviceFamily value(s).

Apple TV Siri Remote support

1. TransformGestureEvent.GESTURE_DIRECTIONAL_TAP -

A new gesture has been introduced to support directional tap from the Siri Remote. This helps in navigating through a collection of items one-by-one. The direction of the tap can be judged by referring to the offsetX and offsetY values of the event object similar to a SwipeEvent.

2. TransformGestureEvent.GESTURE_SWIPE -

Swipe Events are now supported on Apple TV similar to other platforms. However, the values of stageX and stageY properties remain fixed as received from the native operating system, which is the center of the screen. AIR developers can read a new velocity property in Swipe Events to manage the fast movements based on the strength of swipe.

3. Mouse Events and Touch Events -

Mouse Events on Apple TV are generated only on Siri Remote Click and are thus limited to CLICK, MOUSE_UP, and MOUSE_DOWN. Touch Events are generated on Siri Remote Touch when Multitouch.inputMode is set to TOUCH_POINT.

4. Menu and Play/Pause Buttons -

In addition to Siri Remote Touch surface, support for the Menu and Play/Pause buttons is added. AIR developers can subscribe to KeyboardEvents.KEY_DOWN and KEY_UP events to listen to these button presses. Use the preventDefault method to override the default behavior or Menu button.

  Keycode Keyname
Menu 0x01000012
KEYNAME_MENU="Menu"
Play/Pause 0x01000020 KEYNAME_PLAYPAUSE="PlayPause"

Follow Apple's Guidelines for using Siri Remote Buttons and Gestures in your applications.

StageText Support for Apple TV

StageText on Apple TV takes focus by default. To manage focus on different objects in your application keep a note of the below points-

  1. To override default focus from StageText, or to assign focus to any other display object use stage.focus.
  2. To assign focus to StageText, use stageText.assignFocus().

ANE Support for Apple TV

ANE for tvOS can be packaged by adding a new platform "appleTV-ARM" in extension.xml.

<platform name="appleTV-ARM">
    <applicationDeployment>
        <nativeLibrary>sample.a</nativeLibrary>
        <initializer>SampleExtInitializer</initializer>
        <finalizer>SampleExtFinalizer</finalizer>
    </applicationDeployment>
</platform>

Place the native .a and library.swf in a folder called appleTV-ARM.

Sample ane packaging command - 

adt -package -target ane sampleAne.ane extension.xml -swc sampleLibrary.swc -platform appleTV-ARM -C appleTV-ARM library.swf sample.a

Creating icons and images for Apple TV applications

Follow the steps below to create Assets.car using Xcode for generating application icons, launch images, and TopShelf images for your Apple TV application.

Step 1. Create project.

  1. On your Mac, open Xcode and choose File > New > Project > tvOS Application > Single View Application.
  2. Provide a name for the app and click Create.
  3. In the general tab of your project, select Deployment Target as 9.2.
Create project

Step 2. Click Assets.xcassets in the left column and drag your images to different sections App Icon - Large, App Icon - Small, Top Shelf Image, and Launch Image.


For icon sizes and specifications, follow Apple's guidelines for tvOS icons and images.

Specify app icon and launch image

Step 3. Run and package the app.

  1. Run this native app on your tvOS device (tvOS 9.2+) and check if your icons and images appear correctly.
  2. Go to the .app file created in your file system where you created the project — right click, .app file and click show package contents.
  3. Copy the Assets.car file from the package. 
    You can package the app with the extracted Assets.car as shown in the following ADT command:
<path to adt> -package -target ipa-app-store -provisioning-profile <.mobileprovision> -keystore <.p12> -storetype pkcs12 -storepass <password> <.ipa> <.xml> <.swf> Assets.car

Add the tags mentioned below in the application descriptor file before packaging for your images:

<key>UILaunchImages</key>
<array>
  <dict>
    <key>UILaunchImageSize</key>
    <string>{1920, 1080}</string>
    <key>UILaunchImageName</key>
    <string>LaunchImage</string>
    <key>UILaunchImageMinimumOSVersion</key>
    <string>9.0</string>
    <key>UILaunchImageOrientation</key>
    <string>Landscape</string>
    </dict>
</array>
<key>TVTopShelfImage</key>
<dict>
<key>TVTopShelfPrimaryImage</key>
<string>Top Shelf Image</string>
<key>TVTopShelfPrimaryImageWide</key>
<string>Top Shelf Image Wide</string>
</dict>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<string>App Icon - Small</string>
</dict>

Support for embed bitcode in Apple TV applications

Starting AIR 25, ADT supports a new switch -embedBitcode to add bitcode to your iOS and tvOS applications. To learn more about bitcode, read here.

Switch details: 

  • Name of the switch: -embedBitcode
  • Values(iOS): yes or no. Defaults to no 
  • Values(tvOS): yes or no. Defaults to no(yes for ipa-app-store target as it is a mandatory requirement by Apple) 
  • Usage: -embedBitcode yes 
  • Order: Just before the code signing options 

Example of ADT packaging command:

<AIRSDK>/bin/adt -package -target <target type> <other options> -embedBitcode yes -provisioning-profile <SampleProvisioning.mobileprovision> -storetype pkcs12 -keystore <SampleCertificate.p12> -storepass <password> Example.ipa Example-app.xml Example.swf

Note:

  1. Embedding bitcode enables AIR developers to upload the tvOS applications on the AppStore where bitcode is required.
  2. Embedding bitcode in the application increases both application’s size and packaging time.
  3. Embedding bitcode requires that all the ANEs also include bitcode. If not present, adt can throw error packaging errors as below

ld: bitcode bundle could not be generated because '/var/folders/d3/yxwv5yn5715fk31lq36lnk780000gn/T/805ef2d4-5fe2-4ec9-a773-a3cc39845fa1/lib.nativeExtension.systemVersion.a(systemVersion.o)' was built without full bitcode.

All object files and libraries for bitcode must be generated from Xcode Archive or Install build for architecturearm64Compilation failed while executing: ld64

Using Adobe Scout for Apple TV

Developers can use Adobe Scout for profiling on Apple TV. For more details, refer article.

Points to note

  1. If Assets.car is created from Xcode 9, the icon tag in application descriptor file should be 

    <key>CFBundlePrimaryIcon</key>
    <string>App Icon</string>


    If Assets.car is created from Xcode 8, the icon tag in application descriptor file should be

    <key>CFBundlePrimaryIcon</key>
    <string>App Icon - Small</string>


  2. The maximum size for a tvOS app bundle is 200 MB.
  3. Accessing File system, except Cache directory, throws error 3001: File or directory access denied. 
    The applications on tvOS have write access only in the cache directory. This is purge-able by the operating system when space is low.
  4. Creating a cursor-like implementation in your app on tvOS can lead to app rejection by Apple, as it does not comply with the Human Interface Guidelines for Apple TV.
  5. Apple TV applications are 64 bit only.
  6. The AIR property SoundMixer.audioPlaybackMode defaults to VOICE on Apple TV. Changing its value to MEDIA does not have any effect.
  7. Apple TV does not support Clipboard. 
  8. Local Shared Object .sol file does not get created on tvOS because of file system issues.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy