xcode - Apple Watch 通知问题 : WatchKit error - unable to find interface controller class to instantiate

标签 xcode compiler-errors viewcontroller apple-watch

当我尝试动态推送通知 Controller 时出现以下错误。

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 上。我将有关通知 Storyboard的模块更改为观看套件扩展。

任何帮助或建议表示赞赏。

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

最佳答案

有两件事要重新检查,

  • 当您创建了 WKUserNotificationInterfaceController 的新子类时,您是否选择了 Watchkit 扩展作为目标而不是 iOS 应用目标 ?您可以通过 Select Project > Select Watchkit Extension Target > Build Phases > Compile Sources 来验证这一点。在这里,您应该看到之前创建的 NotificationInterface.m 文件。如果您看不到,那么您在创建文件时选择了错误的目标。然后解决方案是您可以创建一个选择正确目标的新类。
  • 在 Storyboard 中,确保正确添加了自定义类名。同样在有效负载文件中,类别名称应与设置为 Storyboard 场景的类别匹配,以避免将来出现错误。
  • 关于xcode - Apple Watch 通知问题 : WatchKit error - unable to find interface controller class to instantiate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29353763/

    相关文章:

    iphone - 问在xcode4中使用json

    c++ - 错误: expected primary-expression before '/' token

    java - 通用类型解析 - 编译器步骤

    Swift Xcode 6.1 破坏了我的代码 |操作数错误

    ios - 为多个 View Controller 使用一个属性列表 (.plist)

    ios - Alamofire 发布请求错误调用中的额外参数 'method'

    swift - 向 Xcode 输出添加换行符

    ios - 在 View 中将 Stripe PaymentKit 信用卡文本字段居中

    iphone - 跳过带有委托(delegate)的 View Controller

    ios - 运行 UIViewController 时出现 SIGABRT?