watchOS 1 quickie -- debugging reloadRootControllersWithNames errors

If you've ever used the API reloadRootControllersWithNames(names: [AnyObject], contexts: [AnyObject]?) in any non-trivial way, you're likely to encounter the frustration of getting this error spamming your logs and causing a lot of issues:

*********** ERROR -[SPRemoteInterface _interfaceControllerClientIDForControllerID:] clientIdentifier for interfaceControllerID:114D0003 not found

Generally this doesn't seem all too helpful. What is interfaceControllerID:114D0003 anyway?

It turns out this is the ID in a private property called _viewControllerID. There is a little bit of code you can add to your willActivate() to see what the _viewControllerID is for each of your pages.

    override func awakeWithContext(context: AnyObject?) {
        if let vcID = self.valueForKey("_viewControllerID") as? NSString {
            println("Page One: \(vcID)")

With a little bit of key-value coding trickery, we can get access to the private variable. Knowing exactly which WKInterfaceController is misbehaving really saves time when you're hunting down to clear out all references to the old controller before blowing it away with the reloadRootControllersWithNames call.

Hope this quick tip helps all of you too.