Xcode 6 error: "Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier."

I'm trying to build an extension project and Xcode keeps throwing the error in subject.

Xcode log error

Needless to day, the extension's bundle id is prefixed with app's bundle id.

Product Name: ro.chitza.TodayPics.$(TARGET_NAME:rfc1034identifier

Extension bundle id

I've tried cleaning the build folder and rebuilding, no luck. The funny thing is the entire project got built for a few times, but after some code and UI changes it started failing. Even if I create new projects, the same thing happens after about 5-6 builds.

Did anyone else encounter this error? Any hints for a solution or workaround?

65193 次浏览

I got the same error, you probably add a extension like Today widget, since the extension is also a binary itself so it has its own plist, and make sure in extension's plist the bundle id is prefixed with app's bundle id. Hope this helps.

Try a Clean before the Build. This fixed the problem for me (Xcode 6b2).

I had to manually change the BundleID in the extension's info.plist to what I needed.

I filed a radar : rdar://17487465

The problem is likely that you added a folder using "Create folder references" when adding it to your project (like I did). @Jacob's fix didn't work for me :(

enter image description here

I had to delete the folder reference I added to my project, then clean and build, and that fixed it for me.

enter image description here

Make sure your:

Target App A -> Built Settings -> Code Signing -> Release

is the same with:

Target App A (Extension) -> Built Settings -> Code Signing -> Release

I was having the same problems. Changing the CFBundleIdentifier for my WatchKit extension to something other than the original value used when I first added the WatchKit extension and re-setting my shared app group entitlement fixed it for me.

this helped me:

The extension needs to have the parent's bundle ID as its prefix.

For example, if you app is com.ronnathan.myapp, your extension has to be com.ronnathan.myapp.today. You renamed the app target, now go into the extension target and change the name to match.

taken from here

In my case, this error occurred when I changed App bundle identifier. I also have WatchKit App in my project.

To fix this, update the WatchKit Extension and WatchKit App bundle Id prefix with the new bundle id of your app. Check info.plist in both targets.

Also update the following -

Update the following with the new Watch App bundle id. WatchKit Extension > Info.plist - NSExtension->NSExtensionAttributes->WKAppBundleIdentifier

Update the following with the new app id. WatchKit App > Info.plist - WKCompanionAppBundleIdentifier

After changing all the values don't forget to Clean product once.

It looks like the bundle ID behavior changed when WatchOS 2 arrived.

Previously I had an extension bundle identifier like this:

com.mycompany.myappname.watchkitextension

Somewhere else on Stackoverflow it was mentioned that the extension bundle identifier should be in this format, but no matter what I tried Xcode kept throwing errors at me.

The only possible solution is changing the extension bundle identifier to:

com.mycompany.myappname.watchkitapp.watchkitextension

I am pretty sure this wasn't the case with an WatchOS 1 app. A problem because of this change is that you can't actually generate an app id for the bundle identifier com.mycompany.myappname.watchkitextension. This isn't necessary, just set all provisioning profiles in the build settings to automatic and don't forget to use the right code signing certificate for you release/ad-hoc/debug schemes.

I actually found out that this approach works because Xcode suggested fixing the problem and this is what it did.

Target->General-->Embedded Binaries delete the older and select the new this was how i solved this problem enter image description here

I just clean derived folder and it helps me in these situations.

It might have happened that you duplicated your targets to do a clone app. For instance you selected each of your targets and duplicated them. When you cloned your watchkit extension target its target membership could be automatically assigned to the original watch app.

To fix this, you would need to go to yours original "WatchKit extension.appex" file in Project Navigator and unselect Target Membership in File Inspector for your new clone watch app target. You should do the opposite for your duplicated "Watchkit extension-copy.appex" and make sure it has only duplicated "watch app-copy" target selected there.

Go to each target > Build Settings > Product Bundle Identifier > (Rename to whatever)

I made changes like:

Main app bundle id: com.myapp.testapp

and

Extension app bundle id: com.myapp.testapp.myextension

and its works!!!

This was Helpful for me:

I was getting:

Xcode couldn't find any iOS App Development provisioning profiles matching

So I changed the Bundle Identifier name i.e com.example.something to com.example.something1, and then cleaned the build.

Make sure you change all the dependant bundle id as well..njoy!!

Make sure bundle identifier of Extension have prefixed with app bundle identifier. If its same and still giving error, then go to the .plist file of Extension and change their Bundle Identifier.

I tried most of the solutions given here, but it did not helped me to fix the issue in Xcode 9.4

This SO Answer helped me fix the issue.

What i did is simply

  1. Unchecking the Automatically manage signing for all the targets and the project

  2. In code signing making it iOS Developer for all the targets and the project.

  3. Clean the project, then close the project and open it.

  4. Now Enable the Automatically manage signing for the target and choose the developer account. Then build it.

It fixed me the error. I don't know when Apple will fix these type of issues. It eats lot of hours.

Edit: I am using This answer too, That my target bundle id is com.companyname.projectname and for the extension bundle id com.companyname.projectname.myextension

when we develop watch app then there is 3 target associate with the app. Their target must have the following style of bundle identifier.

  • The target for iPhone: com.company.app
  • The target for iWatch: com.company.app.watch
  • The target for iWatch Extension: com.company.app.watch.extension

In info.plist for watch target, it must have

WKCompanionAppBundleIdentifier = com.company.app

and in info.plist for watch app extension, it must have

NSExtension > NSExtensionAttributes > WKAppBundleIdentifier = com.company.app.watch

The solution is already covered in a lot of answers:

Containing App Bundle Id: com.alphabet.gmail

and

Extension app bundle id: com.alphabet.gmail.notificationServiceExtension

But why should it be prefixed?

Because Apple wants communication between apps to be by the containing app's bundleId and avoid devs having to go around and send messages to the bundleID of the app Extension.

For example, your server must send a field named apns-topic to send a push notification to APNS so the app can download an image. The value of that topic is the bundleID.

But it's not the bundle ID of the service extension. It's the bundleId of the main app itself.

However on the actual physical phone, both the bundleIDs (com.alphabet.gmail.notificationServiceExtension and com.alphabet.gmail exist).

So how does the OS deliver the notification to the app extension and not the main app?

My understanding is that the OS looks for a target that:

  • Has a BundleId that is prefixed with com.alphabet.gmail example: Extension app bundle id: com.alphabet.gmail.notification
  • Has an NSExtensionPointIdentifier set to com.apple.usernotifications.service. You should not touch this value. It's just a pre-defined value by Apple.

enter image description here

For xCode v12 I solved that problem with one click:

TARGETS -> Build Phases -> Embed App Extensions

and check: Copy only when installing

enter image description here

Compile error: Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier

Extension App id should extend a Containing App id

//for example
//Extension App id
com.company


//Containing App id
com.company.extension

It worked for me after deleting Onesignal runner