WatchKit Extension bundle identifiers

时间:2015-05-12 23:19:46

标签: ios watchkit apple-watch bundle-identifier

I am trying to build my app but it failed. I am shown the message below.

error: WatchKit Extension doesn't contain any WatchKit apps whose bundle identifiers match "com.domain.appname.watchkitapp". Verify that the value of WKAppBundleIdentifier in your WatchKit Extension's Info.plist matches the value of CFBundleIdentifier in your WatchKit App's Info.plist.

I have recently changed if (b==true) { } to "com.domain.appname.watchkitapp".

I cannot find where to change this.

4 个答案:

答案 0 :(得分:166)

更改捆绑包标识符时必须小心,这里应该如何设置(您需要更改 iPhone应用的Info.plist中的每个标识符, Watchkit扩展程序 Watchkit应用程序):

iPhone Application Info.plist:

根据需要设置任何包标识符(“Bundle identifier”属性)。

示例:

Bundle identifier: com.fruitcompany.orange

WatchKit App Info.plist

此处的捆绑标识符必须以iPhone应用程序的标识符为前缀,如下所示(示例):

Bundle identifier: com.fruitcompany.orange.watchkit

您还需要更改必须与iPhone应用程序包标识符匹配的WKCompanionAppBundleIdentifier,如下所示:

WKCompanionAppBundleIdentifier: com.fruitcompany.orange

Watchkit Extension Info.plist:

此处的捆绑标识符必须以iPhone应用程序的标识符为前缀,如下所示(示例):

Bundle identifier: com.fruitcompany.orange.watchkit.extension

您还需要在WKAppBundleIdentifier属性下设置NSExtension

WKAppBundleIdentifier

WKAppBundleIdentifier标识符必须与WatchKit应用包标识符匹配,如下所示:

WKAppBundleIdentifier: com.fruitcompany.orange.watchkit

答案 1 :(得分:15)

首先,让我强调@DejanSkledar在本页面上的优秀答案,因为答案中提到的所有位置都很重要。

那就是说,答案的精确设置对我来说还不够。我想补充一下这个答案并指出,自从watchkit 2开始,当你从应用程序,到手表应用程序,然后最终到捆绑ID的应用程序扩展时,似乎需要一个层次结构。 / p>

以下是我找到edwardmp's answer on a related issue后对我有用的每个相应info.plist文件中的设置。

iPhone App的捆绑ID: com.domain.yourapp

观看App的捆绑ID: com.domain.yourapp.watchkit

Watchkit的扩展包ID: com.domain.yourapp.watchkit.extension

正如您所看到的,iPhone应用程序有一个watchkit应用程序,它本身恰好有一个watchkit扩展,并且每个级别必须反映在它们各自的bundle id中。

完成关系后,手表应用程序必须使用它(WKCompanionAppBundleIdentifier)指向它所属的iPhone应用程序,并且手表扩展程序必须指向它所属的手表应用程序(WKAppBundleIdentifier。)

观看应用的WKCompanionAppBundleIdentifier: com.domain.yourapp

观看应用的扩展WKAppBundleIdentifier: com.domain.yourapp.watchkit

希望这能节省一些时间,因为我不得不在这几个小时内挣扎:(

答案 2 :(得分:1)

您还可能需要更改项目iOS随播广告应用的信息页中的WKCompanionAppBundleidentifier键,以匹配监视工具包扩展信息info.plist中的WKAppBundleIdentifer键。当我复制一个早期的监视工具包项目并更改了监视工具包扩展名info.plist中的WKAppBundleIdentifier以匹配监视工具包info.plist中的软件包标识符时,我发现了这一点,并且该项目仍然遇到了同样的错误。您需要转到Finder,找到iOS随播项目info.plist,然后双击它,然后根据需要更改WKCompanionAppBundleIdentifer密钥。通过查看Xcode中的info.plist,我无法看到这个密钥。

答案 3 :(得分:0)

因此,当您只想在测试设备上运行时,您不一定会改变某些内容。但您需要再申请两个配置文件才能测试手表应用。可以从扩展目标和监视应用目标获取这两个附加标识符。当您想要将观看应用程序上传到 App Store

时,您也需要执行相同的操作