WatchKit App won't compile: “error: WatchKit Extension doesn't contain any WatchKit apps”

无人久伴 提交于 2019-11-30 07:07:06

This error occurred for me when I changed the bundle id of my main iOS App. This is what I did in the project explorer

  1. Under WatchApp --> plist

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

  2. Under WatchApp Extension --> plist NSExtension-->NSExtensionAttributes-->WKAppBundleIdentifier ==> Give the id of your watchkit app (eg: com.xxxx.appname.watchkitapp)

this fixed the error for me.

Main reasons to this error,

1 Incorrect watch app bundle id in watchkit extension plist file.

  1. Missing dependancy of watchapp.app in watchkit extension target.

Apple document with catalag example may help https://developer.apple.com/library/ios/technotes/tn2410/_index.html

I noticed this on Xcode version 8.2.1. Here is how I fixed it.

Go to "WatchKit App" -> Build Settings -> Packaging -> Product Name

Change it so any string different from current string. Agreed that it is a bizarre solution as called in the link below.

Source: 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/

Below settings worked for me

  • In Main App Info.plist

Bundle identifier:com.domain.WatchKit-table

  • In Watchkit App Info.plist

WKCompanionAppBundleIdentifier:com.domain.WatchKit-table

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

  • WatchKit Extension Info.plist

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

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

Note: my bundle id has * as the third component. WatchKit-table is my project name

I ran into this problem on XCode Version 10.2 (10E125), i realizes when i changed WatchkitApp Bundle identifier one key in watchkitapp extension did not changed and stayed as old bundle identifier.

the path to plist: /Users/.../YourXcodeProjectFolder/Project/YourWatchkitExtensionFolder/info.plist

the problem occurd here:

<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>

the key WKAppBundleIdentifier was made the problem, so i changed it by my self.

In my case I had problem with building of the extension library. In fact it was not built and I had two errors: 1. From linker about absense of the extension library. 2. From Xcode about "missing" NSExtensionPointIdentifier key.

Fix of linking error also fixed this message.

I noticed this with xcode 10.0 after changing the build number.

Cleaning the build folder, closing xcode, and re-opening worked for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!