Rey Gonzales Rey Gonzales - 7 months ago 206
iOS Question

xcodebuild different provisioning profile for target dependency

I'm trying to build my app with xcodebuild:

xcodebuild -workspace "RG.xcworkspace" -scheme "Production" -configuration "Release" build CONFIGURATION_BUILD_DIR="${TEMP_DIR}" PROVISIONING_PROFILE="1234-5678-9098-7654-3210"

My scheme has two targets. One target is the app, the other is the app extension (I built an extension for Safari). The app extension is a target dependency. Each target requires a separate provisioning profile. I don't know how to specify the PROVISIONING_PROFILE for the dependency. I'm getting this error, as expected:

CodeSign error: code signing is required for product type 'App Extension' in SDK 'iOS 8.1'

StackOverflow and the man page for xcodebuild don't seem to come up with anything. Does anyone know how to build a project with xcodebuild that relies on two provisioning profiles?


I spent far too long working on this today. I was on my way to bed when the answer hit me:

In each of your targets's Build Settings you should set a $VARIABLE for the profile name. To do this, selected "Other" from the bottom of the list of profiles. Doing this will open a text field - choose a different $VARIABLE for each target - for example I chose $APP_PROFILE for the container app target and $EXTENSION_PROFILE for my Today extension target

Adding a build variable variable...

This will result in something like the following:


Finally, when building with xcodebuild, specify the profile UUIDs as you did with PROVISIONING_PROFILE:

xcodebuild ... APP_PROFILE="85b6f019-d5e5-43a7-9e8f-e3aaed64a7e4" EXTENSION_PROFILE="e50cf605-ab63-40ad-8329-2758359ea748"

Building from within XCode seems to be unaffected - as far as I could tell XCode is selecting the default profiles (as if in "Automatic" mode)

Theoretically this would support multiple extensions too.

Works for me with XCode 6.3 :)