简体   繁体   English

Xcode-命令行构建

[英]Xcode - command line build

I've been working on creating a shell script which will let me archive and extract the ipa file from my working project. 我一直在创建一个shell脚本,它将使我可以从我的工作项目中存档和提取ipa文件。

#!/bin/sh
cd `dirname $0`
xcodebuild -scheme appName clean archive -archivePath ./build/AppName
xcodebuild -exportArchive -exportOptionsPlist ./build/exportOptions.plist -archivePath  ./build/AppName.xcarchive -exportPath ./build/appName

The exportOptions.plist is: exportOptions.plist为:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>method</key>
        <string>ad-hoc</string>
    </dict>
</plist>

I will further need a way to change the Bundle identifier and the Team to the customer's. 我将进一步需要一种将Bundle标识符和Team更改为客户的方法。 Adding PRODUCT_BUNDLE_IDENTIFIER=$com.changed.appname to the first line of the xcodebuild will it change the Bundle identifier to what I need ? PRODUCT_BUNDLE_IDENTIFIER=$com.changed.appname添加到xcodebuild的第一行,它将把Bundle标识符更改为我需要的标识符吗?

ie xcodebuild -scheme appName PRODUCT_BUNDLE_IDENTIFIER=$com.changed.appname clean archive -archivePath ./build/AppName xcodebuild -scheme appName PRODUCT_BUNDLE_IDENTIFIER=$com.changed.appname clean archive -archivePath ./build/AppName

Is this right ? 这是正确的吗 ? What about the team ? 那团队呢? Or should I use the exportOptions.plist for these settings ? 还是应该对这些设置使用exportOptions.plist?

Thank you. 谢谢。

You can use these commands to manipulate the project files directly. 您可以使用这些命令直接操作项目文件。 From my experience, the xcodebuild commands sometimes don't accept the parameters we pass as provisioning profiles, team ID, etc.. 根据我的经验,xcodebuild命令有时不接受我们作为配置文件,团队ID等传递的参数。

So the best way to guarantee it's changed the way you want is to manipulate the xcodeproj file 因此,确保已更改所需方式的最佳方法是操纵xcodeproj文件

  1. Changing provisioning style to manual 将配置样式更改为手动

sed -ie "s/ProvisioningStyle = \\".*\\"/ProvisioningStyle = \\"Manual\\"/" <project_name>.xcodeproj/project.pbxproj

  1. Changing the code signing identity 更改代码签名身份

sed -ie "s/CODE_SIGN_IDENTITY = \\".*\\"/CODE_SIGN_IDENTITY = \\"<signing_identity_name>\\"/g" <project_name>.xcodeproj/project.pbxproj

  1. Changing provisioning profile 更改配置文件

sed -ie "s/PROVISIONING_PROFILE = \\".*\\"/PROVISIONING_PROFILE = \\"<provisioning_profile_udid>\\"/g" <project_name>.xcodeproj/project.pbxproj

sed -ie "s/PROVISIONING_PROFILE_SPECIFIER = \\".*\\"/PROVISIONING_PROFILE_SPECIFIER = \\"<provisioning_profile_name>\\”/g" <project_name>.xcodeproj/project.pbxproj

Note: Please be mindful of the spaces, this method use regexs to match and replace values in your project file 注意:请注意空格,此方法使用正则表达式来匹配和替换项目文件中的值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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