简体   繁体   中英

xcode 8 xcodebuild manual code signing from command line for multiple provision profiles

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.

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}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM