Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
214 views
in Technique[技术] by (71.8m points)

ios - WatchKit: unable to find interface controller class

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...