Fre*_*son 26 xcodebuild ios provisioning-profile
我正在设置Jenkins以自动化iOS构建.是否有可能提供未添加到Xcode中的配置工具的.mobileprovision文件到xcodebuild?
我知道我可以使用PROVISIONING_PROFILE和PROVISIONING_PROFILE [sdk = iphoneos*],但是他们需要将配置文件添加到管理器中.
我知道我可以用xcrun进行操作.但在运行xcrun之前,我必须使用xcodebuild成功签署应用程序.
有什么办法可以将配置文件(.mobileprovision)提供给xcodebuild吗?
Ben*_*ton 47
我们有一个解决方案 - 基本上你需要做的是通过将.mobileprovision文件复制到以移动配置文件的UUID命名的目录来'安装'.mobileprovision文件.这是双击.mobileprovision文件时Xcode Organizer实际执行的操作.
有一个名为mpParse的程序可以从脚本使用的mobileprovision文件中提取UUID - 链接在代码中下载.然后将mobileprovision文件复制到正确的位置很简单.
这是我用来做这个的shell脚本:
#!/bin/sh
# 2012 - Ben Clayton (benvium). Calvium Ltd
# Found at https://gist.github.com/2568707
#
# This script installs a .mobileprovision file without using Xcode. Unlike Xcode, it'll 
# work over SSH.
#
# Requires Mac OS X (I'm using 10.7 and Xcode 4.3.2)
#
# IMPORTANT NOTE: You need to download and install the mpParse executable from     http://idevblog.info/mobileprovision-files-structure-and-reading
# and place it in the same folder as this script for this to work.
#
# Usage installMobileProvisionFile.sh path/to/foobar.mobileprovision
if [ ! $# == 1 ]; then
 echo "Usage: $0 (path/to/mobileprovision)"
 exit
fi
mp=$1
uuid=`/usr/libexec/PlistBuddy -c 'Print UUID' /dev/stdin <<< $(security cms -D -i ${mp})`
echo "Found UUID $uuid"
output="~/Library/MobileDevice/Provisioning Profiles/$uuid.mobileprovision"
echo "copying to $output.."
cp "${mp}" "$output"
echo "done"
您可以直接从https://gist.github.com/2568707下载脚本
运行脚本后,可以在xcodebuild中使用PROVISIONING_PROFILE和PROVISIONING_PROFILE [sdk = iphoneos*]来创建应用程序.我们在生产中使用它.
编辑:仅供参考,我在这里问了一下这个问题(可以从命令行"安装"Xcode .mobileprovision文件吗?)并在没有人知道的情况下提出上述问题:-)
更新: 
作为mpParse的替代品,可以使用苹果工具:
/usr/libexec/PlistBuddy -c 'Print UUID' /dev/stdin <<< $(security cms -D -i path_to_mobileprovision)