WatchKit应用程序将不会编译:“错误:WatchKit扩展不包含任何WatchKit应用程序”

在这个问题上有几个职位,但没有提出的解决scheme在我的情况下工作。 我正在尝试将WatchKit集成到一个简单的示例应用程序(我已经尝试了几个),遵循Apple提供的说明。 当我编译时,我得到以下错误信息:

“错误:WatchKit扩展程序不包含任何WatchKit应用程序,请确认WatchKit应用程序的Info.plist中的WKWatchKitApp值设置为YES。

我已经成功地编译并运行了苹果手表“目录”的例子,所以我知道事情正在从iPhone到Watch的angular度。 当我尝试与现有应用程序集成时,似乎有些事情是不正确的。 我已经看到这个主题的post(例如, WatchKit应用程序不会在模拟器上运行 ),但没有修复工作在我的情况; 包ID都显示正确。 注意我正在尝试在iPhone 6上编译并运行,而不是在模拟器上运行。 有什么build议么?

当我更改我的主iOS应用程序的包ID时,发生此错误。 这是我在项目浏览器中做的

  1. 在WatchApp下 – > plist

    WKCompanionAppBundleIdentifier ==> Give the id of the iOS App (com.xxxx.appname)

  2. 在WatchApp扩展下 – > plist NSExtension-->NSExtensionAttributes-->WKAppBundleIdentifier ==> Give the id of your watchkit app (eg: com.xxxx.appname.watchkitapp)

这固定了我的错误。

这个错误的主要原因,

1 watchkit扩展名为plist文件中的手表应用程序包ID不正确。

  1. 在watchkit扩展目标中缺lesswatchapp.app的依赖性。

具有catalag示例的Apple文档可能有助于https://developer.apple.com/library/ios/technotes/tn2410/_index.html

下面的设置为我工作

  • 在主App的Info.plist

包标识符:com.domain.WatchKit-table

  • 在Watchkit App Info.plist中

WKCompanionAppBundleIdentifier:com.domain.WatchKit表

包标识符:com.domain.WatchKit-table。 watchkitapp

  • WatchKit扩展Info.plist

NSExtension> NSExtensionAttributes> WKAppBundleIdentifier: com.domain.WatchKit-table.watchkitapp

包标识符:com.domain.WatchKit-table。 watchkitapp.watchkitextension

注意:我的包ID有*作为第三个组件。 WatchKit表是我的项目名称

我在Xcode版本8.2.1上注意到了这一点。 这是我如何修复它。

转到“WatchKit应用程序” – >“生成设置” – >“打包” – >“产品名称”

将其更改为与当前string不同的任何string。 同意这是一个奇怪的解决scheme,如下面的链接中所述。

来源: https : //blogofpuneet.wordpress.com/2015/05/02/xcode-build-error-watchkit-extension-doesnt-contain-any-watchkit-apps-verify-that-the-value-of-wkwatchkitapp-在你的watchkit -应用-信息-plist中,被设置到是/

在我的情况下,我有build设扩展库的问题。 其实它并没有build立,我有两个错误:1.从链接器关于扩展库的缺席。 2.从Xcode关于“缺less”NSExtensionPointIdentifier键。

链接错误的修复也解决了这个消息。