我们对此有一个解决方案 - 本质上,您需要做的是通过将 .mobileprovision 文件复制到以移动配置文件的 UUID 命名的目录来“安装”它。这就是双击 .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)