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

问题描述

当我尝试动态推送通知控制器时出现以下错误.

I am getting the following error when I am trying to push my notification controller dynamically.

2015-03-30 13:18:53.324 MyApp WatchKit 扩展[79826:1951724]太长而无法显示自定义通知.回到静态.2015-03-30 13:26:13.831 MyApp WatchKit 扩展 [79826:1957863]WatchKit 错误 - 无法找到接口控制器类'_TtC26MyApp_WatchKit_Extension19InterfaceController' 实例化

我听说可能存在故障,但据我所知,它只发生在 Xcode beta 上,而不是 Xcode 6.2.我将有关通知故事板的模块更改为观看套件扩展.

I heard there might be a glitch, but as far as I am concern it is only occurring on the Xcode beta and not Xcode 6.2. I change the module regarding the notification storyboard to watch kit extension.

感谢任何帮助或建议.

我正在使用苹果在处理 iWatch 通知时提供的自动生成的有效负载.

Edit : I am using the auto generated payload that apple provide when dealing with notifications for iWatch.

推荐答案

需要重新检查的两件事,

Two things to recheck,

  • 当您创建 WKUserNotificationInterfaceController 的新子类时,您是否选择了Watchkit 扩展作为目标而不是 iOS 应用程序目标?您可以通过 Select Project > Select Watchkit Extension Target > Build Phases > Compile Sources 验证这一点.在这里您应该看到之前创建的 NotificationInterface.m 文件.如果您看不到,那么您在创建文件时选择了错误的目标.那么解决方案是您可以创建一个选择正确目标的新类.
  • 在 Storyboard 中,确保正确添加了自定义类名.同样在有效负载文件中,类别名称应与设置为故事板场景的类别匹配,以避免将来出现错误.
  • When you have created a new subclass of WKUserNotificationInterfaceController, Have you selected Watchkit extension as a target instead of iOS app target? You can verify this by Select Project > Select Watchkit Extension Target > Build Phases > Compile Sources. Here you should see NotificationInterface.m file created earlier. If you can't see then you have selected wrong target when creating a file. Then solution is you can create a new class with correct target selected.
  • In Storyboard, make sure custom class name is correctly added. Also in Payload file, category name should match with category set to storyboard scene just to avoid future errors.

这篇关于Apple Watch 通知问题:WatchKit 错误 - 无法找到要实例化的接口控制器类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 13:24