WatchKit App无法编译:“错误:WatchKit扩展不包含任何WatchKit应用程序”

问题描述 投票:9回答:7

关于这个问题有几个帖子,但是我提议的解决方案都没有。我正在尝试按照Apple提供的说明将WatchKit集成到一个简单的示例应用程序中(我现在尝试了几个)。当我编译时,我收到以下错误消息:

“错误:WatchKit扩展程序不包含任何WatchKit应用程序。验证WatchKit应用程序的Info.plist中WKWatchKitApp的值是否设置为YES。”

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

ios objective-c iphone apple-watch
7个回答
24
投票

当我更改了我的主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)

这为我解决了错误。


3
投票

这个错误的主要原因,

1 watchkit扩展plist文件中的监视应用程序包ID不正确。

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

带有目录示例的Apple文档可能有助于qazxsw poi


3
投票

我在Xcode版本8.2.1上注意到了这一点。这是我修复它的方法。

转到“WatchKit App” - >“构建设置” - >“包装” - >“产品名称”

更改它以使任何字符串与当前字符串不同。同意这是一个奇怪的解决方案,如下面的链接所示。

资料来源:https://developer.apple.com/library/ios/technotes/tn2410/_index.html


2
投票

以下设置对我有用

  • 在主应用程序Info.plist中

Bundle identifier:com.domain.WatchKit-table

  • 在Watchkit App Info.plist中

WKCompanionAppBundleIdentifier:com.domain.WatchKit表

Bundle identifier:com.domain.WatchKit-table.watchkitapp

  • WatchKit扩展Info.plist

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

捆绑标识符:com.domain.WatchKit-table.watchkitapp.watchkitextension

注意:我的bundle id有*作为第三个组件。 WatchKit-table是我的项目名称


1
投票

在更改内部版本号后,我注意到了xcode 10.0。

清理构建文件夹,关闭xcode,并重新打开为我工作。


0
投票

在我的情况下,我有建立扩展库的问题。实际上它没有构建,我有两个错误:1。从链接器关于扩展库的缺席。 2.从Xcode关于“缺少”NSExtensionPointIdentifier密钥。

修复链接错误也修复了此消息。


0
投票

我在https://blogofpuneet.wordpress.com/2015/05/02/xcode-build-error-watchkit-extension-doesnt-contain-any-watchkit-apps-verify-that-the-value-of-wkwatchkitapp-in-your-watchkit-apps-info-plist-is-set-to-yes/上遇到了这个问题,我意识到当我更改了WatchkitApp Bundle标识符时,watchkitapp扩展中的一个键没有改变并保留为旧的bundle标识符。

plist的路径:/Users /.../YourXcodeProjectFolder/Project/YourWatchkitExtensionFolder/info.plist

问题出现在这里:

XCode Version 10.2 (10E125)

关键的<key>NSExtension</key> <dict> <key>NSExtensionAttributes</key> <dict> <key>WKAppBundleIdentifier</key> <string>com.applecode.water.watchkit</string> </dict> <key>NSExtensionPointIdentifier</key> <string>com.apple.watchkit</string> </dict> 成了问题,所以我改变了自己。

© www.soinside.com 2019 - 2024. All rights reserved.