8

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!

Michael
  • 111
  • 1
  • 6
  • Same issue. But I found that possible to build via command line "today widget" separately. May be possible build main project and tell to "xcodebuild" do not resign extension? – Sergey Kopanev Jan 12 '15 at 17:20
  • Hi Sergey, can you be more specific about how you're building the "today widget" separately? – Michael Jan 13 '15 at 17:52
  • 1
    Sure just using one more xcodebuild command and put target TODAYWIDGET (did you see that it is Target of proj?). Thanks, – Sergey Kopanev Jan 14 '15 at 14:15
  • 1
    I couldn't find a way to do exactly what you're trying to achieve, so instead I set the profiles in Xcode, and then build it without the provisioning profile arguments – Rey Gonzales Jan 21 '15 at 16:41
  • @ReyGonzales yes, I use same way. Not found another. Thanks, – Sergey Kopanev Feb 13 '15 at 06:48

1 Answers1

3

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.

Community
  • 1
  • 1
Max Chuquimia
  • 7,494
  • 2
  • 40
  • 59