Developing for AppleWatch: “call me ‘sometimes’”

Hagen Hübel
5 min readApr 15, 2019

Lazy Sunday. I was looking at my AppleWatch and was curious, how to make it displaying Crypto prices like BTC and ETH. There are already apps for that. But I wanted to build my own.

All in all it was not the best experience. XCode is simply too buggy for that right now!

My setup was:

  • Macbook Pro 17 inch
  • XCode 10.2 (I tried all versions from 9.4 over 10.0, 10.1 until 10.02
  • iPhoneX with iOS 12.1
  • AppleWatch Series 4 with WatchKit OS 5.1

Building an App for the Watch was dead easy. But the challenge began when I started to add a “Complication” to the App. To populate the pieces in the Clock face with own “Apps” is a so called “Complication”. And this where things really get complicated:

Sometimes these Complications show app in the Configuration of the Watch face, sometimes not. I played around with several attempts and repeated steps: sometimes they worked, sometimes not. Sometimes XCode could not connect to the Apple Watch, sometimes it could.

Sometimes it was deploying something else but not my App:

Doing 10 equal steps one after another resulted eventually in 10 different results.

Let’s dive into more detail:

After my first attempt of building the App and the Complication I could use the Complication on my real Apple-Watch. But then strange things happened.

After some minor code changes the Complication was not selectable any more in the Watch App. So I have tried the following steps:

  1. Create a new Watchkit-App with Complications
  2. Run this App on my Watch
  3. Try to reuse the Complication in the Module-Scheme

I have created several Apps this way repeatedly. With the first created App it happened well. With the second and third not. In all cases I did nothing else than using XCode’s assistant to create the project and run the application on AppleWatch without any custom code: every new created App-skeleton behaved differently. Some Apps showed up in the Modular-Configurator, some not.

Sometimes XCode just displayed an error message called

“App Installation failed. Could not read from the Device”.

Some minutes later it changed to

“App installation failed: the operation timed out.”

I was constantly closing XCode, reopening it, shutting down my Mac, rebooting iPhone and AppleWatch. Everytime I had another experience.

Sometimes XCode considered my Apple Watch as “paired device unavailable for development”. Reconnecting the iPhone to the Machine per USB cable did it then. But it occured quiet often.

Steps to reproduce:

  1. Create a new iOS App with WatchKit App:

2. Make sure that “Include Complication” is selected, as adding it later is really complicated.

3. Select the Scheme for the Complication and run it onto a real device. One can also launch it on the Watch-Simulator, but in my experience testing a Complication on simulator was not really smooth.

4. Launch it on iOS + paired Apple Watch:

It seems that one of the most fragile steps is this one:

“preparing to Install MyApp”

If this fails, it failed completely. XCode is unable to install the App then on the device. For me, it is persisting right now. After several installations of those Apps on my Watch, it will run into a timeout.

The Complication will not appear in the Watch-App like in this example, which went fine for some hours but not yet anymore to reproduce:

However, for those lucky guys that are able run through the cable, the real fun begins. Lets say, we want to provide a SmallModular and a LargeModular Complication, we would add these Lines into the ComplicationController.m:

https://gist.github.com/itinance/32b5573c04f0ad19861bcd4e21d52ee7

while creating the real display could look like this:

Usually, if everything went fine, one would see this Complication in the configuration of your modular Watch face like here the Stocks-Complication:

I could not find out so far, how to make a Complication real visible there. Sometimes they appeared. Sometimes not. A single restart of the Application through XCode could make them disappearing without any change of Code.

Restarting everything from scratch helped here for a while. Or reconnecting the iPhone to my Mac. Sometimes it did. Sometimes not.

At the end I made it. But it constantly felt like operating with a very fragile system out of last century. Currently I am unable to deploy the final App changes onto the device due to errors described above. Restarting from scratch with a new XCode AppleWatch-App-Skeleton will sometimes make it onto the device, sometimes not. At the time of writing, it is a fundamentally broken system.

--

--