ios - WatchKit App 无法编译 : "error: WatchKit Extension doesn' t contain any WatchKit apps"

标签 ios objective-c iphone apple-watch

关于这个问题有几篇文章,但没有一个建议的解决方案适用于我的情况。我正在尝试按照 Apple 提供的说明将 WatchKit 集成到一个简单的示例应用程序中(我现在已经尝试了几个)。编译时出现以下错误消息:

"error: WatchKit Extension doesn't contain any WatchKit apps. Verify that the value of WKWatchKitApp in your WatchKit App's Info.plist is set to YES."

我已成功编译并运行 Apple Watch“Catalog”示例,因此我知道从 iPhone 到 Watch 的角度来看一切正常。当我尝试与现有应用程序集成时,似乎有些地方不对劲。 我在这里看过关于这个主题的帖子(例如 WatchKit app wont run on simulator ),但在我的情况下没有任何修复工作;包 ID 似乎都是正确的。请注意,我正在尝试在 iPhone 6 而不是模拟器上编译和运行。 有什么建议吗?

最佳答案

当我更改我的主要 iOS 应用程序的 bundle id 时,我发生了这个错误。 这是我在项目浏览器中所做的

  1. 在 WatchApp 下 --> plist

    WKCompanionAppBundleIdentifier ==> 给出 iOS 应用的 id (com.xxxx.appname)

  2. 在 WatchApp 扩展下 --> plist NSExtension-->NSExtensionAttributes-->WKAppBundleIdentifier ==> 给出你的 watchkit 应用的 id(例如:com.xxxx.appname.watchkitapp)

这为我修复了错误。

关于ios - WatchKit App 无法编译 : "error: WatchKit Extension doesn' t contain any WatchKit apps",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32063038/

相关文章:

ios - 动态增加 UILabel 和 TableView Cell 的高度?

iphone - 关闭 Controller 时将值传递给父 Controller

iphone - 根据另一个选择器值更改选择器值

javascript - 如何在 iPhone WebView 上检测可滚动 div 的橡皮筋事件?

objective-c - 如何在 Cocoa 上的 MenuItem 上显示多个键或 'chords'

iphone - 强制调用 UIViewController 子类方法

ios - 使用 UIGraphicsBeginImageContextWithOptions 缩放 View 和图像

objective-c - 使用 Objective-C 的 for 循环在屏幕上显示按钮

iphone - 在 Objective-C 中对数组进行排序

ios - 下一级方法