Monthly Archives: April 2016

Apple WatchKit 2.2 – NATIVE apps what are they good for?

We have a workout app that supports the Apple Watch, and it was something that I’d hacked into the original project when the watch first shipped.  It’s a Unity3D based project and back then, adding the Watch target was a real pain, but I managed to get it done and even got it working as best as I could.

One of the major complaints was that the watch didn’t always notify users when a workout ended and a new one would start.  With the original WatchKit there was no way to access the haptic feedback system or even make the watch go ‘bing’. I’d used local notifications to make this happen as best as possible, but iOS decides if it’s going to forward a notification to the watch or not, and there was no way to ensure such forwarding – very haphazard…

Enter WatchKit 2 and NATIVE watch apps.  I was quite excited about this, I’d be able to update the code and fix the biggest complaint the app received from our users.  I’d be able to make the watch buzz and bing on command!

I started this update a few weeks back, and migrated the code to the new WatchKit2 system and had the code run on the watch.  In the simulator, things were working really well, however I was having difficulties in getting the app to actually run on my watch.  Turns out all was not well with my XCode project and the watch wouldn’t validate the binary and run it.  Of course, there was no error popups or feedback to XCode, just silence.

After numerous reboots of everything involved, a pairing of the watch to another test phone, I decided to try a new XCode project just to see where the problem actually was.  That new project built & ran just fine, and when I copied my code & storyboards across from the old project (one file at a time) that also worked as expected.  Huzzah, I had my code running on my watch.  I retired the old XCode project and continued with the new one.

At this point, I was able to run my code on an actual watch.  This was after a frustrating few days of trying everything else to resolve the problems.  So my frustration level was then enhanced when I discovered that an App running on the actual watch is suspended when the watch sleeps, or the user taps the crown to return to the clock display.  This didn’t happen on the simulator!  Some simulation!

It turns out all my previous work was pretty useless.  The App I’d moved to run independently of the attached iPhone does not work as expected.  If I setup an NSTimer to alert the user when it’s time to switch an activity, unless the user keeps the watch alive by tapping the screen, that NSTimer is suspended when the watch sleeps.  The timer never expires, the user is never alerted, and the App fails.

Even if I put all the code back on the iPhone, I can’t even make the watch vibrate and bing when the NSTimer expires, unless the watch happens to be awake when that happens and the user happens to have my App in the foreground.  So I’m back to the unreliable notification system with all the same problems as before.  There really is no point in building an update at this point.

I was pretty excited by WatchKit2, I really thought it would solve the issues I had with the original WatchKit, but it seems that once again, Apple have dropped the ball and not provided a cure.  I know the battery drain is the biggest concern, but seriously, couldn’t you spare enough juice to run one special background timer and let us notify the user when it expires…