2
votes

In Xcode 7 I was building project through command line for multiple provision profiles by using following commands. I have multiple provision profiles and multiple code signing certificate linked to those profiles so I need to sign the IPA file with appropriate provision profile.

PROVISION_PROFILE="My Provision profile name"

xcodebuild -workspace ../ProjectName.xcworkspace -scheme "${PRODUCT_NAME}" -sdk iphoneos -configuration "${CONFIGURATION}" archive -archivePath "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.xcarchive"

xcodebuild -exportArchive -archivePath "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.xcarchive" -exportPath "${BINDIR}/${PACKAGE_NAME}-${CURVERSION}.ipa" -exportProvisioningProfile "${PROVISION_PROFILE}"

Now these commands not working for Xcode 8. I uncheck the automatically manage signing after that it gives below error

"someProjectName" requires a provisioning profile. Select a provisioning profile for the "Debug" build configuration in the project editor. Code signing is required for product type 'Application' in SDK 'iOS 10.1' Anybody please help me in this.

1
Can you add a screenshot of what the "Signing" section looks like in your project's target settings in Xcode, under General->Signing? It sounds like your Debug configuration doesn't have a provisioning profile set in the project file. - Kevin Aleman
Right, I haven't added provision profile in that section because I want to build this from command line. Because I have multiple provision profiles for different configurations so I need to pass them from command line. Do you know how can I pass them from command line ? - Gaurav
@kgaleman Is this necessary to pass this info from project editor ? - Gaurav

1 Answers

0
votes

You are only specifying the provisioning profile in your -exportArchive command. In the -workspace command, Xcodebuild is reaching into the -scheme you specify, which looks at the project.pbxproj file and grabs the provisioning profiles you placed from the project editor for the configurations specified by the scheme being built.

If you open your project.pbxproj file in a text editor, you'll see that the Debug configuration has no provisioning profile listed, which is why Xcodebuild is throwing this error. To fix this, add your provisioning profiles in the project editor (or in project.pbxproj) for the configurations being built by your scheme.

Edit: Now that I better understand the requirements, editing my answer with another option. You can also do this to manually specify the provisioning profile in your build step:

xcodebuild -workspace ../ProjectName.xcworkspace -scheme "${PRODUCT_NAME}" -sdk iphoneos -configuration "${CONFIGURATION}" archive -archivePath "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.xcarchive" PROVISIONING_PROFILE="${PROVISION_PROFILE}"