2011-01-20 68 views
48

我在这找不到任何东西(也许我只是使用了错误的搜索术语..):
我们正在尝试为我们的应用程序构建一个合理的持续集成设置。为了有一个真正合理的实现,构建服务器应该能够自动刷新来自苹果的已使用的配置文件。与X代码组织者的功能类似,但通过命令行自动完成。
任何线索,如果可能呢?命令行更新供应配置文件

+1

感谢这个问题。到目前为止,我的命令行解决方案是`$ open vnc:// server` ;-) – mpontillo 2012-11-16 01:47:23

+0

看看下面的网址;
http://stackoverflow.com/questions/4369119/how-to-install-developer-certificate-private-key-and-provisioning-profile-for-ios我认为这将有所帮助。 – jfalexvijay 2011-01-22 14:58:00

回答

53

这里是我的bash脚本,其中脚本的第一个参数($ 1)是新配置文件的位置。

rm -Rf ~/Library/MobileDevice/Provisioning\ Profiles/* 
cp "$1"/*.* ~/Library/MobileDevice/Provisioning\ Profiles/ 

基本上,在〜/库/移动设备/预置描述文件/文件夹的任何东西都可以建立与(和将在Xcode中显示出来)。

如果你想站出来一个CI系统,我最近谈了一下使用Hudson的原理,并且提出了一些幻灯片和笔记over here。我的电子邮件在我的网站上,如果您有任何疑问。使用apple_dev_center.rb从https://github.com/lacostej/apple-dev

+2

很酷,谢谢你的回答。但是你有什么想法如何获得$ 1?你如何将配置文件放到你的机器上? – LordT 2011-01-26 08:45:54

1

尝试解析从苹果开发者网站上的信息并下载配置文件为你它们自动复制到正确的位置。

16

更新:Cupertino将不再适用于最新的iTunes。考虑使用sigh代替


听起来像这样的命令行界面将助阵大时间:

https://github.com/nomad/cupertino

它允许你下载所有的分布状况,像这样(感谢@tdubik):

ios profiles:download:all --type distribution

另一种方法是使用Ente rprise开发许可证($ 300 /年),可让您为设备生成而不需要供应!因此,您可以构建应用程序,并将其发送到设备,而无需前往Apple开发人员中心或注册任何新设备。

请注意,这不会允许您将应用程序分发到appstore,但如果您是一个为客户端构建大量应用程序的开发平台,它可能会缓解“构建并发送给客户端”过程的相当程度片!我不确定这是否会出现在Apple的合法使用政策中,因此请在考虑该选项之前检查一下。但是对于原型等可能需要考虑,当他们真的想要发布它时,你可以让他们获得自己的开发人员程序许可证。

0

我一直在努力使这项工作有一段时间。终于做到了!

可以使用fastlane叹息下载并安装您所需要的临时配置文件。

fastlane sigh renew --adhoc -n "provisional_profile_name" 
--app_identifier "your_app_identifier" -u "apple_login _username" --ignore_profiles_with_different_name 

注:此命令需要已 系统中安装的应用程序的任何临时轮廓。否则会给我造成错误。

temporary_profile_name =只是配置文件名称的名称,不需要 需要扩展名。

1

Sigh可以为您管理供应配置文件。但是,它不支持安装已经自己提取的配置文件。不过,我仍然发现看看他们的source for how they actually install a profile once they've downloaded it是很有价值的。

值得庆幸的是,它非常类似于James J's answer

def self.install_profile(profile) 
    UI.message "Installing provisioning profile..." 
    profile_path = File.expand_path("~") + "/Library/MobileDevice/Provisioning Profiles/" 
    uuid = ENV["SIGH_UUID"] || ENV["SIGH_UDID"] 
    profile_filename = uuid + ".mobileprovision" 
    destination = profile_path + profile_filename 

    # If the directory doesn't exist, make it first 
    unless File.directory?(profile_path) 
    FileUtils.mkdir_p(profile_path) 
    end 

    # copy to Xcode provisioning profile directory 
    FileUtils.copy profile, destination 

    if File.exist? destination 
    UI.success "Profile installed at \"#{destination}\"" 
    else 
    UI.user_error!("Failed installation of provisioning profile at location: #{destination}") 
    end 
end 

我有一个脚本来执行此本地安装对我来说:

#!/bin/bash -euo pipefail 

BASH_SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 

cd "$BASH_SOURCE_DIR" 

# by default bash passes the glob characters if nothing matched the glob 
# disable that 
# http://stackoverflow.com/a/18887210/9636 
shopt -s nullglob 
# this creates a proper bash array, which we need since our profiles 
# have funny characters in them 
MOBILE_PROVISIONS=(*.mobileprovision) 
# re-enable default nullglob behavior 
shopt -u nullglob 

# On a brand new machine that has never run any app on a development device 
# the ~/Library/MobileDevice/"Provisioning Profiles" directory doesn't exist 
mkdir -p ~/Library/MobileDevice/"Provisioning Profiles" 

for mobileprovision in "${MOBILE_PROVISIONS[@]}" 
do 
    uuid=$(./uuid-from-mobileprovision.bash "${mobileprovision}") 
    cp "${mobileprovision}" ~/Library/MobileDevice/"Provisioning Profiles"/"${uuid}".mobileprovision 
done 

这依赖于另一个uuid-from-mobileprovision.bash脚本:

#!/bin/bash -euo pipefail 

if [ ! -f "${1}" ] 
then 
    echo "Usage: $0 <path/to/mobileprovision/file>" 1>&2 
    exit 1 
fi 

UUID=$(grep --text --after-context=1 UUID "${1}" | grep --ignore-case --only-matching "[-A-Z0-9]\{36\}") 
if [ -z "${UUID}" ] 
then 
    echo "Invalid mobileprovision file: ${1}" 1>&2 
    exit 2 
else 
    echo "${UUID}" 
fi