Extensions and Apple WatchKit Support

Magnificent colorful vertical shot of a slot canyon in Lower Antelope Canyon in Arizona USA.

Earlier today, Apple announced their updated product line, and with it, the much anticipated Apple Watch. Amongst other things, you’ll be able to use this watch to receive notifications, answer phone calls and talk to Siri, as well as use it as a fitness activity tracker. If you missed the event, you can catch the recording at https://www.apple.com/live/2015-mar-event/.

With all these new hardware capabilities, comes new developer opportunities, and you guessed it, we have updated our SDK for extensions support. Here’s how you can start building today.

Extensions support

The Extensions and WatchKit support was been broken down into two phases:

  1. Support including and shipping Extensions and WatchKit (built natively in Xcode) in Titanium apps
  2. Support building Extensions and WatchKit apps using the Titanium APIs.

The first stage is currently in beta and ready to be tested.

Getting Started

Note: The following steps are intended to show how to include natively-built extensions in Titanium and not how to create or build native extensions.

  1. Download the latest Titanium SDK build from the 3_5_X branch.
  2. Create an extension in Xcode.

  3. In the tiapp.xml of your Titanium app, add an extensions tag (next to the modules tag).

  4. In the extensions tag, add an extension tag.

  5. Add an attribute named projectPath to the extension tag. The value of the attribute should be the path to the folder containing the Xcode project with your extension.

  6. The content of the extension tag should be the target name of the the extension in the Xcode project.

  8. Build your Titanium application like normal for simulator or device. Once the extensions tag is added to the tiapp.xml with an extension as its target, the Titanium app will build the extension and include it in the resulting app.

New APIs

A number of new APIs have been added to the Titanium SDK to facilitate communications with extensions. These APIs allow Titanium apps to share data using App Groups.

  • Ti.App.iOS.UserDefaults: (Object) Essentially the same as Ti.App.Properties, but it does not read from the tiapp.xml and requires its create method to be called with a suiteName to get an instance.
  • Ti.Filesystem.directoryForSuite: (Method) Takes a suiteName as a string and returns the path to that suite’s shared directory
  • Ti.Database.open/install: Now accept a complete path to the database.

For more information checkout TIMOB-18337.

Previous articleHow AmerisourceBergen Built its Mobile App Strategy
Next articleSOA is not dead (and shouldn’t be)


  1. First, great work. I love the quick support of new features!

    I’d like to ask where the Android love is though. It’s been a few months and still no material design support. And it would be great to see Android Wear to match watchkit.

    Again, LOVE the new features. As a Titanium developer, I need to make that other side of the coin sparkle!

  2. I have created an empty Xcode project and added a new WatchApp target to it. Edited the tiapp.xml as explained and tried to run my app.
    Nothing but the error below, what am I doing wrong?

    Do I need to set the bundle id so something else? Provisioning? Signing? Help!


    [ERROR] : ** BUILD FAILED **
    [ERROR] : The following build commands failed:
    [ERROR] : ValidateEmbeddedBinary build/Debug-iphonesimulator/MyApp.app/PlugIns/MyAppWatchKit.appex
    [ERROR] : (1 failure)

  3. The bundle id you give youur WatchApp target must start with the application id of your Titanium App. So if you have set “nl.martijn.myapp” in your Titanium project/tiapp.xml, than you must use “nl.martijn.myapp” as your organization identifier when creating the watchapp target in Xcode.
    If you forget you will get an ugly and not understandable build error…


Please enter your comment!
Please enter your name here