"This app contains an app extension with an illegal bundle identifier" issue
Asked Answered
H

3

13

I'm a bit mixed up, since I changed the app name, Bundle Display name, and Bundle identifier name...and now my app works properly, but my today widget won't.

Whenever I try to run today widget, it builds successfully, but instead of being launched, it says

This app contains an app extension with an illegal bundle identifier. App extension bundle identifiers must have a prefix consisting of their containing application's bundle identifier followed by a '.'.

However, I checked Info.plist and my bundle identifier is

com.myname.myappname

and my bundle identifier of my today widget is

com.myname.myappname.mywidget

Isn't this just right?? I cleaned and built again and again..but it just won't work.

And NO GOOGLE RESULT! Am I the only person with this problem??

My bundle name is not 'myappname', if it is the problem.

Any help is appreciated.

Something's gone bad and I don't know where to look!

Haematoxylin answered 18/1, 2015 at 4:59 Comment(0)
B
6

I ran into a similar problem with the Bundle identifier in a share extension

error

app Info.plist: com.company.product.$(PRODUCT_NAME:rfc1034identifier)
ext Info.plist: com.company.product.$(PRODUCT_NAME:rfc1034identifier)

So I ended up with

app Info.plist: com.company.product.product
ext Info.plist: com.company.product.product_ext

which passed the build checks but refused to run on a device with error:

This app contains an app extension with an illegal bundle identifier. App extension bundle identifiers must have a prefix consisting of their containing application's bundle identifier followed by a '.'.

Once I removed the extra product, the build ran on a device.

correct

app Info.plist: com.company.$(PRODUCT_NAME:rfc1034identifier)
ext Info.plist: com.company.product.$(PRODUCT_NAME:rfc1034identifier)

app Info.plist: com.company.product
ext Info.plist: com.company.product.product_ext

I discovered my error when I accidentally changed the application Info.plist instead of the extension Info.plist. To aid in debugging the problem, introduce an error into the application Info.plist, and you should get a build error with the Bundle identifier of the app and extension:

 ERROR.com.myname.myappname
Byway answered 25/1, 2015 at 23:2 Comment(1)
I cannot test your method since I already solved this problem by creating a new project and copying and pasting all my code to the new project...Anyway, thanks!Haematoxylin
D
33

If the selected answer doesn't work, I found what appears to be an issue in xcode switching between some target schemas which caused this.

In this case, try doing a complete clean, as well as a clean of the build folder (hold down ALT when selecting product/clean).

Addendum: As this happens fairly often for me now, a quicker fix is to also remove all .appex files. Eg:

cd ~/Library/Developer/Xcode/DerivedData
find . -name "*.appex" -exec rm -fr {} \;
Danielson answered 28/6, 2015 at 16:3 Comment(4)
Clean of the build folder fixed this for me! I believe this should be the accepted answer.Firenze
Sadly for me, both the accepted and this answer didn't work. Still getting the error. :/Olvan
This worked for me. Thanks. I did previously change the extension name. So I wonder if that had something to do with it.Corruption
Removed the DerivedData folder's contents. Clean and then built the project. It worked for me.Hankow
B
6

I ran into a similar problem with the Bundle identifier in a share extension

error

app Info.plist: com.company.product.$(PRODUCT_NAME:rfc1034identifier)
ext Info.plist: com.company.product.$(PRODUCT_NAME:rfc1034identifier)

So I ended up with

app Info.plist: com.company.product.product
ext Info.plist: com.company.product.product_ext

which passed the build checks but refused to run on a device with error:

This app contains an app extension with an illegal bundle identifier. App extension bundle identifiers must have a prefix consisting of their containing application's bundle identifier followed by a '.'.

Once I removed the extra product, the build ran on a device.

correct

app Info.plist: com.company.$(PRODUCT_NAME:rfc1034identifier)
ext Info.plist: com.company.product.$(PRODUCT_NAME:rfc1034identifier)

app Info.plist: com.company.product
ext Info.plist: com.company.product.product_ext

I discovered my error when I accidentally changed the application Info.plist instead of the extension Info.plist. To aid in debugging the problem, introduce an error into the application Info.plist, and you should get a build error with the Bundle identifier of the app and extension:

 ERROR.com.myname.myappname
Byway answered 25/1, 2015 at 23:2 Comment(1)
I cannot test your method since I already solved this problem by creating a new project and copying and pasting all my code to the new project...Anyway, thanks!Haematoxylin
S
6

For me this due to the misnamed bundle identifier for my app extension. Similar to @dougbeal's answer, but slightly different formatting that worked for me:

com.company.AppName
com.company.AppName.Extension

I was missing the "." before Extension

This also addressed a related to issue

Sargassum answered 1/12, 2015 at 9:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.