64

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.

Pang
  • 9,564
  • 146
  • 81
  • 122
Tom Coomer
  • 6,227
  • 12
  • 45
  • 82

5 Answers5

207

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!

Pranav Kasetti
  • 8,770
  • 2
  • 50
  • 71
Dejan Skledar
  • 11,280
  • 7
  • 44
  • 70
  • 3
    I followed the same but am getting Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier. – Syed Ismail Ahamed Sep 27 '15 at 06:34
  • 2
    should the extensions bundle identifer be com.fruitcompany.watchkit.entension ? – Syed Ismail Ahamed Sep 27 '15 at 06:40
  • 1
    when i created another app id with com.fruitcompany.orange.watchkit.entension it works i wonder what makes it do so. – Syed Ismail Ahamed Sep 27 '15 at 07:06
  • same as @SyedIsmailAhamed it's not working but all Bundle Identifier are corrects – SocoM Dec 07 '15 at 16:01
  • 20
    Hiding `WKAppBundleIdentifier` nested inside `NSExtension`, but then mentioning it only by its unscoped name in the error message was pure evil. I just assumed it was missing and added it manually to the root, which of course resulted in the same exact error and much frustration. Thanks for spreading the truth! – Ohad Schneider Dec 08 '15 at 15:33
  • Please tell me how many Provisioning profile needed for this? – Mihir Oza Dec 15 '15 at 10:54
  • 1
    I don't think that this is correct.The documentation states (https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringYourApp/ConfiguringYourApp.html), that the bundle id should be like com.fruitcompany.orange.watchkitapp instead of com.fruitcompany.organe.watchkit for the watchkit app. And for the extension we would use com.fruitcompany.orange.watchkitextension instead of com.fruitcompany.orange.watchkit.extension. Could you please adjust your answer? – Renato Stauffer Feb 06 '17 at 12:03
  • One Comment: Xcode 10 seems to be case-sensitive. At least with: `WKAppBundleIdentifier` – RayInNoIL Jan 13 '19 at 03:48
  • these steps don't work getting Embedded binary's bundle identifier error – Meet Ios Developer Jul 22 '20 at 09:42
20

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

Community
  • 1
  • 1
AdamJonR
  • 4,703
  • 2
  • 22
  • 24
2

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.

Nelson Capes
  • 411
  • 3
  • 12
  • 2
    Actually, you have to open the info.plist with TextEdit and make the change to the key. You also have to make the same change in the watch kit extension info.plist. I verified that this works with a project in which I changed the bundle identifier in the iOS target, the watch kit target, and the watch kit extension target. – Nelson Capes Jul 15 '16 at 00:36
0

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

Lucas Huang
  • 3,998
  • 3
  • 20
  • 29
  • I have created three provisioning profiles, One for the app, one for the extension and one for the watch app. That is the reason that I had to change the identifier. However it does not seem to have changed in one of the locations. – Tom Coomer May 13 '15 at 08:20
  • Actually, there are no need to change after adding those two watch target. Because XCode will automatically generate two different identifiers for you. So, you only need to do copy and paste it over to create App Id next time. And yes, you do need to change the identifiers in the info.plist accordingly if you have changed your identifiers on those two targets. Hope this will make you convenient. – Lucas Huang May 14 '15 at 16:45
0

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

闪电狮
  • 367
  • 2
  • 9
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/30092821) – Bert Blommers Oct 16 '21 at 17:23