application-identifier incorrect in app extension

Since upgrading to Xcode 9.3 I can not export my archive because it reports:


Profile doesn't match the entitlements file's value for the application-identifier entitlement.


If I look in the embedded.mobileprovision file for etension I see that the application-identifier in the entitelments is for the host app and not the extension.


I am building the app using xcodebuild:


xcodebuild -verbose clean archive -project projects/IOSExtDummy/IOSExtDummy.xcodeproj -scheme IOSExtDummy -configuration Release -archivePath bin/plugins.xcarchive HEADERMAP_INCLUDES_PROJECT_HEADERS=NO USE_HEADERMAP=NO PROVISIONING_PROFILE_SPECIFIER=FooBar_dev CODE_SIGN_IDENTITY="iPhone Developer" CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM=W4Zxxxxx PRODUCT_BUNDLE_IDENTIFIER=com.foo.bar


If I build it with the Xcode GUI it is OK.


Can anybody shed some light on this? I have already spent a long day trying to sort this out.

Accepted Reply

For the benefit of anybody with a similar problem the solution was to set the bundle IDs and provisioning profile specifier via individual variables.


So in the xcode project in each target I use these variables in place of the values then I set them on the command line when I do the build.

$APP_BUNDLE_IDENTIFIER

$APP_PROVISIONING_PROFILE_SPECIFIER

$EXT_BUNDLE_IDENTIFIER

$EXT_PROVISIONING_PROFILE_SPECIFIER


xcodebuild -verbose clean archive -project projects/IOSExtDummy/IOSExtDummy.xcodeproj -scheme IOSExtDummy -configuration Release -archivePath bin/plugins.xcarchive HEADERMAP_INCLUDES_PROJECT_HEADERS=NO USE_HEADERMAP=NO APP_PROVISIONING_PROFILE_SPECIFIER=FooBar_dev EXT_PROVISIONING_PROFILE_SPECIFIER=FooBar_ext_dev CODE_SIGN_IDENTITY="iPhone Developer" CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM=W4Zxxxxx APP_BUNDLE_IDENTIFIER=com.foo.bar EXT_BUNDLE_IDENTIFIER=com.foo.bar.myExt


I wish there was some documentation on doing command line builds of apps with extensions.

Replies

For the benefit of anybody with a similar problem the solution was to set the bundle IDs and provisioning profile specifier via individual variables.


So in the xcode project in each target I use these variables in place of the values then I set them on the command line when I do the build.

$APP_BUNDLE_IDENTIFIER

$APP_PROVISIONING_PROFILE_SPECIFIER

$EXT_BUNDLE_IDENTIFIER

$EXT_PROVISIONING_PROFILE_SPECIFIER


xcodebuild -verbose clean archive -project projects/IOSExtDummy/IOSExtDummy.xcodeproj -scheme IOSExtDummy -configuration Release -archivePath bin/plugins.xcarchive HEADERMAP_INCLUDES_PROJECT_HEADERS=NO USE_HEADERMAP=NO APP_PROVISIONING_PROFILE_SPECIFIER=FooBar_dev EXT_PROVISIONING_PROFILE_SPECIFIER=FooBar_ext_dev CODE_SIGN_IDENTITY="iPhone Developer" CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM=W4Zxxxxx APP_BUNDLE_IDENTIFIER=com.foo.bar EXT_BUNDLE_IDENTIFIER=com.foo.bar.myExt


I wish there was some documentation on doing command line builds of apps with extensions.

>wish there was some documentation


Feel free to make that request via the bug report link, below, adding your report # to your thread for reference, thanks and good luck.

Hi, it's happen to me also since updgrading to Xcode 9.3 even with 9.3.1 as well.

I have notification extension and it's working fine to archive on Xcode 9.2, using another mac with the same git branch.

I have tried everything I can with spent some days to solve it but with no luck.


Based on your solution and explanation, honestly I don't understand how to solve it.

Could you please explain more detail how to apply this solution?

Maybe not using a command line to build but using the Xcode directly or something simpler.


Thank you