WatchKit:无法找到接口控制器类 [英] WatchKit: unable to find interface controller class

查看:118
本文介绍了WatchKit:无法找到接口控制器类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将接口控制器添加到情节提要中,将其自定义类"设置为WKInterfaceController子类,在模拟器中启动应用程序并导航到指定的接口控制器.

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错误-无法找到要实例化的接口控制器类'TestController'

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:

  • ***********错误-[SPRemoteInterface _interfaceControllerClientIDForControllerID:] interfaceControllerID的clientIdentifier :(空)未找到
  • ***********错误-找不到[SPRemoteInterface _interfaceControllerClientIDForControllerID:] interfaceControllerID的clientIdentifier:7120004
  • *********** 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错误-无法找到要实例化的接口控制器类'_TtC29myWatchApp_WatchKit_App19TestController'
  • ***********错误-[SPRemoteInterface _interfaceControllerClientIDForControllerID:] interfaceControllerID的clientIdentifier :(空)未找到
  • ***********错误-找不到[SPRemoteInterface _interfaceControllerClientIDForControllerID:] interfaceControllerID:6E20004的clientIdentifier
  • 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

推荐答案

重命名WatchKit目标后出现此错误,但最终意识到:如果重命名WatchKit目标,则必须通过Interface Builder中的接口并确保每个模块的名称也都已重命名.

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.

您可以通过选择接口控制器,单击身份检查器"(或command-option-3),删除模块名称,然后跳出标签来进行此操作.它会自动用新的目标名称填充.为我做到了!

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!

这篇关于WatchKit:无法找到接口控制器类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆