Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Signing app with xcodebuild command line with PROVISIONING_PROFILE fails

I trying to sign my app command line using Xcode.

Running xcodebuild command-line on MyApp.xcodeproj like so:

xcodebuild -project "MyApp.xcodeproj" -target "MyApp" -sdk "iphoneos" -configuration *Release* PROVISIONING_PROFILE="xxxx-xxxx-xxxx-xxxx" CODE_SIGN_IDENTITY="iPhone Developer: something.com (SOMEVALUE)"

Gives following error:

Check dependencies
Provisioning profile "iOS Team Provisioning Profile: *" doesn't include signing certificate "iPhone Developer: something.com (SOMEVALUE)".
Provisioning profile "iOS Team Provisioning Profile: *" is Xcode managed, but signing settings require a manually managed profile.
Code signing is required for product type 'Application' in SDK 'iOS 10.3'

** BUILD FAILED **

What is wrong ? What is missing in my xcodebuild command ?

How can I include the signing certificate that its asking about ?

What I tried from answer & comments below
As I understand, a dedicated distribution profile should be used with Release build. That is present in the system. I just need to know how to use it with xcodebuild command for manual signing if I can.

Executing security find-identity -p codesigning -v | grep "$CODE_SIGN_IDENTITY" gives a list of 5 signing identities ones of them clearly states as iPhone Distribution: My Company (SOME123ID).

*So, can I use the distribution profile with xcodebuild manual signing? If yes, How can I get the actual ID of a distribution profile to use with xcodebuild command?

like image 962
TheWaterProgrammer Avatar asked Jul 12 '17 07:07

TheWaterProgrammer


People also ask

How do I manually manage signing in Xcode?

Open the project using Xcode. Select the root project directory, and go to the Signing and Capabilities tab. Here, you can either check Automatically manage signing or do the signing manually. If you check the Automatically manage signing checkbox, then you will just need to select the Team from the drop-down list.

Where is automatically manage signing?

After you've enabled the `Automatically manage signing` option, you need to choose your development team, if it isn't already selected. It is placed underneath the checkbox. 4. Then click on the Build Settings tab, select to filter “All” and “Combined”, and in the search field type “Signing”.

What is allowProvisioningUpdates?

Aug 14, 2020. Since Xcode 9, Apple provides automatic code signing identity management from the command line by using the xcodebuild command. Using the “allowprovisioningupdates” flag, you can enable code signing; however you may get errors like: Your session has expired.


1 Answers

Using PROVISIONING_PROFILE is deprecated since Xcode8. Try PROVISIONING_PROFILE_SPECIFIER instead. PROVISIONING_PROFILE_SPECIFIER="Human Readable Prov Profile Name"

It may also be necessary to turn off Xcode's Automatic Signing:

Xcode9: simply append CODE_SIGN_STYLE="Manual" to your xcodebuild command

Xcode8: sed -i '' 's/ProvisioningStyle = Automatic;/ProvisioningStyle = Manual;/' TestApp/TestApp.xcodeproj/project.pbxproj && xcodebuild ...

You can check your Xcode Version on the command-line with xcodebuild -version

like image 199
Sven Driemecker Avatar answered Oct 19 '22 07:10

Sven Driemecker