Configure Xcode Build Settings Terminal

I want to change the build settings of .xcodeproj without using the Xcode IDE, but with the help of terminal commands (more precisely, Codesigning Identity and Provisioning Profile).

I searched everything, but only found commands for building / archiving the project from the terminal , which I do not want. . I just want to change the settings so that when I open the project in Xcode, it has the signature identifiers and preparation profile set for what I installed in the terminal.

The Xcodebuild team only builds / archives the project, using what I pass as parameters, it does not set them as values ​​in the project build settings.

Running xcodebuild -target <target-name> -showBuildSettings in the terminal where my project is located gives me full project build options, but I had no way to set them.

I also read here about using -setObject , but that also did not help me, since it also creates code using the parameter values ​​that I gave instead of actually setting them.

Currently using Xcode 6.3 and Xcode 7.

Any help would be appreciated.

+3
source share
1 answer

All Xcode settings are actually stored in <project-name>.xcodeproj/project.pbxproj . He looks like

 buildSettings = { CODE_SIGN_ENTITLEMENTS = ""; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ... PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; SKIP_INSTALL = YES; }; 

The code signing identifier is controlled by the CODE_SIGN_IDENTITY key, and the Provisioning Profile is controlled by the PROVISIONING_PROFILE key.

project.pbxproj - a text file that can be edited using traditional CLI word processing tools, for example sed with

 sed -ie 's/CODE_SIGN_IDENTITY = "iPhone Developer"/CODE_SIGN_IDENTITY = ""/g' <project-name>.xcodeproj/project.pbxproj sed -ie 's/PROVISIONING_PROFILE = ""/PROVISIONING_PROFILE = "1c28c979-6bef-4917-aa34-92aecd91315c";/g' <project-name>.xcodeproj/project.pbxproj 

You can get a list of available Signing Identities using

 security find-identity -v -p codesigning 

For PROVISIONING_PROFILE , this is the UUID of the initialization file, it can be obtained using

 grep -aA1 UUID /path/to/mobileprovision 
+3
source

Source: https://habr.com/ru/post/912620/


All Articles