WatchKit Extension bundle identifiers

IosWatchkitApple WatchBundle Identifier

Ios Problem Overview


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 "com.domain.appname.watchkitapp" to "com.domain.differentappname.watchkitapp".

I cannot find where to change this.

Ios Solutions


Solution 1 - Ios

You have to be careful when changing the bundle identifiers, and here's how they should be set (you need to change each identifier in the Info.plist for the iPhone app, for the Watchkit Extension and for the Watchkit App):

iPhone Application Info.plist:

Set any bundle identifier as you like (the "Bundle identifier" property).

Example:

Bundle identifier: com.fruitcompany.orange

WatchKit App Info.plist

The bundle identifier here must be prefixed with the identifier of the iPhone application, like this(example):

Bundle identifier: com.fruitcompany.orange.watchkit

You also need to change the WKCompanionAppBundleIdentifier which must match with the iPhone application bundle identifier, like this:

WKCompanionAppBundleIdentifier: com.fruitcompany.orange

WatchKit Extension Info.plist:

The bundle identifier here must be prefixed with the identifier of the iPhone application, like this(example):

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

You also need to set the WKAppBundleIdentifier under the NSExtension attribute.

WKAppBundleIdentifier

The WKAppBundleIdentifier identifier must match with the WatchKit app bundle identifier like this:

WKAppBundleIdentifier: com.fruitcompany.orange.watchkit

Don't forget to check that your Bundle ID in project target is the same as in Info.plist!

Solution 2 - Ios

First, let me highlight the excellent answer on this page by @DejanSkledar, as all of the locations noted in the answer are important.

That said, the precise setup in that answer was not sufficient for me. I'd like to supplement this answer and point out that since watchkit 2, there appears to be a hierarchy required as you work from the app, to the watch app, and then finally to the app extension in terms of the bundle id's.

Here are the settings in each of their corresponding info.plist files that worked for me after I found edwardmp's answer on a related issue.

iPhone App's Bundle Id: com.domain.yourapp

Watch App's Bundle Id: com.domain.yourapp.watchkit

Watchkit's Extension Bundle Id: com.domain.yourapp.watchkit.extension

As you can see, an iPhone app has a watchkit app, which itself happens to have a watchkit extension, and each of these levels must be reflected in each of their respective bundle id's.

Completing the relationships, the watch app must point to the iPhone app to which it belongs using it's (WKCompanionAppBundleIdentifier), and the watch extension must point to the watch app to which it belongs (WKAppBundleIdentifier.)

Watch App's WKCompanionAppBundleIdentifier: com.domain.yourapp

Watch App's Extension WKAppBundleIdentifier: com.domain.yourapp.watchkit

Hopefully this saves someone some time, as I had to struggle on this for a few hours :(

Solution 3 - Ios

You also may have to change the WKCompanionAppBundleidentifier key in the projects iOS companion app's info p.list to match the WKAppBundleIdentifer key in the watch kit extension info.plist. I found this out when I copied an earlier watch kit project and changed the WKAppBundleIdentifier in the watch kit extension info.plist to match the bundle identifier in the watch kit info.plist and the project still got the same error. You need to go to Finder, locate the iOS companion project info.plist, and double-click on it, then change the WKCompanionAppBundleIdentifer key if necessary. I wasn't able to see this key by looking ant the info.plist in Xcode.

Solution 4 - Ios

So, you don't necessarily change something when you just want to run on test devices. But you do need to request two more provisioning profile in order to test the watch app. Those two additional identifiers can be acquired from extension target and watch app target. That's also the same things you need to do when you want to upload the watch app to App Store

Solution 5 - Ios

> In the WatchKit Extension info.plist is an entry NSExtension. Exand it and you'll find a key WKAppBundleIdentifier which is a reference to the bundle identifier of the WatchApp

Try this from Apple: https://developer.apple.com/forums/thread/5956?login=true

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTom CoomerView Question on Stackoverflow
Solution 1 - IosDejan SkledarView Answer on Stackoverflow
Solution 2 - IosAdamJonRView Answer on Stackoverflow
Solution 3 - IosNelson CapesView Answer on Stackoverflow
Solution 4 - IosLucas HuangView Answer on Stackoverflow
Solution 5 - Ios闪电狮View Answer on Stackoverflow