I tried adding an interface controller to a storyboard, setting its Custom Class to a WKInterfaceController subclass, launched the app in the simulator and navigated to the specified interface controller.
When I do so, I get the following error:
WatchKit error - unable to find interface controller class 'TestController' to instantiate
If I try to interact with the controller (e.g. try launching its button's action), I get the following error:
- *********** ERROR -[SPRemoteInterface _interfaceControllerClientIDForControllerID:] clientIdentifier for interfaceControllerID:(null) not found
- *********** ERROR -[SPRemoteInterface _interfaceControllerClientIDForControllerID:] clientIdentifier for interfaceControllerID:7120004 not found
I tried setting the module name as recommended on this answer, but that still gives me the following errors:
- WatchKit error - unable to find interface controller class '_TtC29myWatchApp_WatchKit_App19TestController' to instantiate
- *********** ERROR -[SPRemoteInterface _interfaceControllerClientIDForControllerID:] clientIdentifier for interfaceControllerID:(null) not found
- *********** ERROR -[SPRemoteInterface _interfaceControllerClientIDForControllerID:] clientIdentifier for interfaceControllerID:6E20004 not found
I got this error after renaming the WatchKit target, but finally realized: if you rename your WatchKit targets, you'll have to go through the interfaces in Interface Builder and make sure the module names for each of them is renamed as well.
You can do this by selecting an interface controller, clicking the Identity Inspector (or command-option-3), delete the module name, then tab away. It will automatically be filled in with the new target name. That did it for me!
This error came up for me because I was not properly handling the didDeactivate
message. My deactivated controller was still receiving messages via MMWormhole
. Once I severed that connection, the error went away. It turns out that in the simulator all the deactivated interface controllers hang around in memory, so you have to carefully make sure they don't get any more messages of any kind. I don't know if this happens on the Watch itself, but of course we should assume so.
I spent way too much time with this issue, but finally figured what it was. The Apple Watch has basically two navigation patterns:
Hierarchical:
[self pushControllerWithName:@"controllerName" context:nil];
Page-based:
[[self class] reloadRootControllersWithNames:@[@"controller1",@"controller2"] contexts:nil];
According to apple:
You cannot combine hierarchical and page-based interface styles. At design time, you must choose the style that best suits your app’s content and design for that style.
So, the issue is that I was mixing both and that leads to undefined behavior like:
*********** ERROR -[SPRemoteInterface _interfaceControllerClientIDForControllerID:] clientIdentifier for interfaceControllerID:(null) not found
Hope this helps other developers
EDIT:
Just a suggestion that worked for me as a workaround, when using Page-based navigation you can still present modal controllers (just saying):
[self presentControllerWithName:@"controllerName" context:nil];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With