Apple Watch notification issue: WatchKit error - unable to find interface controller class to instantiate

坚强是说给别人听的谎言 提交于 2019-12-29 02:08:05

问题


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] 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

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.

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


回答1:


Two things to recheck,

  • 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.


来源:https://stackoverflow.com/questions/29353763/apple-watch-notification-issue-watchkit-error-unable-to-find-interface-contro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!