Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build iOS App Extension through command line

Tags:

ios

I'm trying to build an iOS app containing an app extension from the command line. However when I use the following xcodebuild command to build:

xcodebuild -sdk iphoneos -configuration "Debug" -workspace "/Users/user/build/app_extension_demo/app_extension_demo.xcworkspace" -scheme "AppExtensionDemo" -CODE_SIGN_IDENTITY="iPhone Developer: ios developer" PROVISIONING_PROFILE=34070551-ebe8-412a-b57c-9fbdf9a42ed4 derivedDataPath "/Users/user/build/app_extension_demo/Build/Products/Debug-iphoneos" OBJROOT="/Users/user/build/app_extension_demo/Build/" SYMROOT="/Users/user/build/app_extension_demo/Build/Products" CONFIGURATION_BUILD_DIR=/Users/user/build/app_extension_demo/Build/Products/Debug-iphoneos

I get the following error:

ERROR: Code Sign error: Provisioning profile does not match bundle identifier: The provisioning profile specified in your build settings ("XC Ad Hoc: com.mycompany.AppExtensionDemo") has an AppID of "com.mycompany.AppExtensionDemo" which does not match your bundle identifier "com.mycompany.AppExtensionDemo.NumberWidget".

I'm using a provisioning profile (XC Ad Hoc: com.mycompany.AppExtensionDemo) with AppID of com.mycompany.AppExtensionDemo, but the app extension is expecting a different AppID (com.mycompany.AppExtensionDemo.NumberWidget). Everything builds fine when done through the Xcode app. I noticed that Xcode automagically created the provisioning profile for "com.mycompany.AppExtensionDemo.NumberWidget" for the app extension target. However when building through the command line, I'm not sure how to associate app extension profile to the app extension target. Any help would be appreciated!

like image 437
Michael Avatar asked Nov 18 '14 18:11

Michael


1 Answers

So I've just figured this out and posted my answer here: https://stackoverflow.com/a/29605731/1153630

Basically you can set an $ENVIRONMENT_VARIABLE into the Provisioning Profile field in your targets's Build Settings and assign it from the command line instead of using PROVISIONING_PROFILE=... - have a look at my other answer for more detail.

like image 86
Max Chuquimia Avatar answered Sep 30 '22 16:09

Max Chuquimia