WatchKit Extension bundle identifiers

29,473

Solution 1

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

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

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.

Share:
29,473
Tom Coomer
Author by

Tom Coomer

Updated on July 01, 2022

Comments

  • Tom Coomer
    Tom Coomer almost 2 years

    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.

  • Tom Coomer
    Tom Coomer almost 9 years
    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.
  • Lucas Huang
    Lucas Huang almost 9 years
    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.
  • Syed Ismail Ahamed
    Syed Ismail Ahamed over 8 years
    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
    Syed Ismail Ahamed over 8 years
    should the extensions bundle identifer be com.fruitcompany.watchkit.entension ?
  • Syed Ismail Ahamed
    Syed Ismail Ahamed over 8 years
    when i created another app id with com.fruitcompany.orange.watchkit.entension it works i wonder what makes it do so.
  • Josip B.
    Josip B. over 8 years
    Man you are a life saver!
  • SocoM
    SocoM over 8 years
    same as @SyedIsmailAhamed it's not working but all Bundle Identifier are corrects
  • Ohad Schneider
    Ohad Schneider over 8 years
    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!
  • Mihir Oza
    Mihir Oza over 8 years
    Please tell me how many Provisioning profile needed for this?
  • Nelson Capes
    Nelson Capes almost 8 years
    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.
  • Renato Stauffer
    Renato Stauffer about 7 years
    I don't think that this is correct.The documentation states (developer.apple.com/library/content/documentation/IDEs/…), 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?
  • RayInNoIL
    RayInNoIL over 5 years
    One Comment: Xcode 10 seems to be case-sensitive. At least with: WKAppBundleIdentifier
  • Meet Ios Developer
    Meet Ios Developer almost 4 years
    these steps don't work getting Embedded binary's bundle identifier error
  • Michael N
    Michael N about 3 years
    Watch App's Extension WKAppBundleIdentifier is under NSExtension in the Info.plist
  • Bert Blommers
    Bert Blommers over 2 years
    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