Apple Watch通知问题:WatchKit错误 - 无法找到要实例化的接口控制器类 [英] Apple Watch notification issue: WatchKit error - unable to find interface controller class to instantiate
问题描述
我在尝试动态推送通知控制器时收到以下错误。
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 Extension [79826:1951724]收取
太长,无法显示自定义通知。回到静态。
2015-03-30 13:26:13.831 MyApp WatchKit扩展[79826:1957863]
WatchKit错误 - 无法找到接口控制器类
'_TtC26MyApp_WatchKit_Extension19InterfaceController'实例化
2015-03-30 13:18:53.324 MyApp WatchKit Extension[79826:1951724] Took too long to show custom notification. Falling back to static. 2015-03-30 13:26:13.831 MyApp WatchKit Extension[79826:1957863] WatchKit error - unable to find interface controller class '_TtC26MyApp_WatchKit_Extension19InterfaceController' to instantiate
我听说可能有毛刺,但就我所关心的,它只发生在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.
任何帮助或建议都可以使用。
Any help or suggestions is appreciated.
编辑:我使用苹果提供的处理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应用目标?您可以通过选择项目>选择Watchkit扩展目标>构建阶段>编译源来验证。这里你应该看到之前创建的NotificationInterface.m文件。如果您看不到,则在创建文件时选择了错误的目标。然后解决方案是您可以创建一个新类,并选择正确的目标。
- 在故事板中,确保自定义类名称正确添加。此外,在有效载荷文件中,类别名称应与为故事板场景设置的类别匹配,以避免将来出现错误。
- 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错误 - 无法找到要实例化的接口控制器类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!