Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Watch app starts with error clientIdentifier for interfaceControllerID not found

I'm having a smartwatch app on watchos2. The app always worked but now when it starts I immediately get this error:

Lop_WatchKit_Extension[17535:7854201] *********** ERROR -[SPRemoteInterface _interfaceControllerClientIDForControllerID:] clientIdentifier for interfaceControllerID:447E0002 not found

I found some topics here on stackoverflow but nothing solved the problem.

like image 526
user1007522 Avatar asked Sep 21 '16 07:09

user1007522


1 Answers

In my case, this was due to a retain cycle in one InterfaceController of mine.

If you get the logs similar to:

[default] -[SPRemoteInterface _interfaceControllerClientIDForControllerID:]:0000: ComF: clientIdentifier for interfaceControllerID:XXXXXXXX not found

&/or...

[default] _SendRecordedValues:000: ComF:<-Plugin controller ID XXXXXXXX has no client identifier

First, figure out which InterfaceController has the controller ID XXXXXXXX.

Have this in awake(withContext:)

override func awake(withContext context: Any?) {
    //...

    if let id = self.value(forKey: "_viewControllerID") as? NSString {
        let strClassDescription = String(describing: self)

        print("\(strClassDescription) has the Interface Controller ID \(id)")
    }

    //...
}

This logs:

[Target.Classname: 0xYYYYYYYY] has the Interface Controller ID XXXXXXXX

Once you identify the InterfaceController causing these logs, you can continue to debug.

It could be different in your case but in mine I had created a retain cycle with self in one of my closures within which took awhile to locate but I eventually broke the retain cycle with a [weak self] capture.

Basically, the error logs appear when an InterfaceController is trying to execute some code but it has already been released.


What I already had:

DispatchQueue.main.async {
    self.doSomethingThatDoesSomethingAsync()
}

What I fixed:

DispatchQueue.main.async { [weak self] in
    self?.doSomethingThatDoesSomethingAsync()
}
like image 94
staticVoidMan Avatar answered Oct 22 '22 12:10

staticVoidMan