设置Xcode构建设置终端 [英] Setting Xcode Build Settings Terminal

查看:491
本文介绍了设置Xcode构建设置终端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要更改.xcodeproj的构建设置,而不使用Xcode IDE,但通过终端命令(正确地标记Identityigning Identity和Provisioning Profile)。



我想要的只是更改设置,所以,当我打开Xcode中的项目,它有签名身份和供应配置文件设置为我在Terminal中设置的。



Xcodebuild命令只是使用我作为参数传递的项目来构建/存档项目,



运行 xcodebuild -target< target-name> -showBuildSettings 在我的项目所在的终端,给我完成项目的构建设置,但我没有得到任何方法来设置它们。



此外,我还阅读了此处关于使用 -setObject ,但是也没有帮助我,因为它也使用参数值构建代码,而不是实际设置它们。



目前使用Xcode 6.3和Xcode 7。



任何类型的帮助将不胜感激。

解决方案

所有Xcode设置实际上存储在< project-name> .xcodeproj / project.pbxproj
看起来像

  buildSettings = {
CODE_SIGN_ENTITLEMENTS =;
CODE_SIGN_IDENTITY =iPhone开发者;
CODE_SIGN_IDENTITY [sdk = iphoneos *]=iPhone开发人员;

...

PRODUCT_NAME =$(TARGET_NAME);
PROVISIONING_PROFILE =;
SKIP_INSTALL = YES;
};

代码签名身份 CODE_SIGN_IDENTITY 键和配置参数文件 PROVISIONING_PROFILE 键控制。



project.pbxproj 是一个文本文件,可以通过CLI中的传统文本处理工具进行编辑,例如 sed

  sed -ie / CODE_SIGN_IDENTITY =iPhone开发人员/ CODE_SIGN_IDENTITY = / g'< project-name> .xcodeproj / project.pbxproj 
sed -ie / PROVISIONING_PROFILE =/ PROVISIONING_PROFILE =1c28c979-6bef-4917-aa34-92aecd91315c; / g'< project -name> .xcodeproj / project.pbxproj

您可以获取可用的签名身份

  security find-identity -v -p codesigning 

对于 PROVISIONING_PROFILE ,它是一个 UUID 的配置文件,用



> grep -aA1 UUID / path / to / mobileprovision


I want to change build settings of a .xcodeproj without using Xcode IDE but through terminal commands (Codesigning Identity and Provisioning Profile to be exact).

I have searched all over but only found commands to build/archive the project from terminal, which I Do Not Want. What I want is to just change the settings, so that when I open the project in Xcode, it has the signing identities and provisioning profile set to what I had set in Terminal.

Xcodebuild command just builds/archives the project using what I pass as parameters, it doesn't set them as values in build settings of project.

Running xcodebuild -target <target-name> -showBuildSettings in terminal, where my project resides, gives me complete build settings of the project but I didn't get any method to set them.

Also I read here about using -setObject, but that also didn't help me as it also builds the code using parameters values I gave instead of actually setting them.

Currently using Xcode 6.3 and Xcode 7.

Any kind of help will be appreciated.

解决方案

All Xcode settings is actually store in <project-name>.xcodeproj/project.pbxproj . It 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;
};

Code Signing Identity is controlled by CODE_SIGN_IDENTITY key and Provisioning Profile is controlled by PROVISIONING_PROFILE key.

The project.pbxproj is a text file that can be edited by traditional text processing tools in CLI, such as 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 the list of available Signing Identities with

security find-identity -v -p codesigning

For PROVISIONING_PROFILE, it's a UUID of provisioning file, it can be fetched with

grep -aA1 UUID /path/to/mobileprovision

这篇关于设置Xcode构建设置终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆