xcode 配置文件的命令行更新

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4744959/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:40:31  来源:igfitidea点击:

Command line Update of Provisioning Profiles

iphonexcodeprovisioning

提问by Blitz

I couldn't find anything on this (maybe I'm just using the wrong search terms..):
We're trying to build a sensible continuous integration setting for our apps. To have a REALLY sensible implementation, the build server should be able to automatically refresh the used provisioning profiles from apple. Similar to what the X-Code organizer does, but automagically via command line.
Any clue if that's possible at all?

我在这方面找不到任何内容(也许我只是使用了错误的搜索词......):
我们正在尝试为我们的应用程序构建一个合理的持续集成设置。为了有一个真正合理的实现,构建服务器应该能够从苹果自动刷新使用的配置文件。类似于 X-Code 组织者所做的,但通过命令行自动执行。
任何线索是否可能?

回答by James J

Here's my bash script for it, where the first argument to the script ($1) is the location of the new profiles.

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

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

Basically, anything in that ~/Library/MobileDevice/Provisioning Profiles/ folder can be used to build with (and will show up in Xcode).

基本上,该 ~/Library/MobileDevice/Provisioning Profiles/ 文件夹中的任何内容都可用于构建(并将显示在 Xcode 中)。

If you're looking to stand up a CI system, I recently gave a talk on using Hudson for it, and put up some slides and notes over here. My email is on my site if you have any questions about it.

如果你想建立一个 CI 系统,我最近做了一个关于使用 Hudson 的演讲,并在这里放了一些幻灯片和笔记。如果您对此有任何疑问,我的电子邮件在我的网站上。

回答by Brad Parks

Update: Cupertino will no longer work on latest iTunes. Look into using sighinstead

更新:库比蒂诺将不再适用于最新的 iTunes。考虑使用叹息代替



Sounds like this command line interface will help out big time:

听起来这个命令行界面将大有帮助:

https://github.com/nomad/cupertino

https://github.com/nomad/cupertino

which allows you to download all distribution profiles like so (thanks @tdubik):

它允许您像这样下载所有分发配置文件(感谢@tdubik):

ios profiles:download:all --type distribution

ios profiles:download:all --type distribution

Another approach would be to use an Enterprise development license ($300/year) that lets you build for devices withoutprovisioning! So you can build your app, and send it to a device without ever needing to go to the Apple Dev center or register any new devices.

另一种方法是使用企业开发许可证(300 美元/年),让您无需配置即可构建设备!因此,您可以构建您的应用程序,并将其发送到设备,而无需前往 Apple 开发中心或注册任何新设备。

Note that this wouldn't allow you to distribute your app to the appstore, but if you're a development house that builds tons of apps for clients, it may ease your "build and send to clients" process quite a piece! I'm not sure if this would be in Apple's legitimate use policies or not, so please check that out before considering that option. But it might be something to consider for prototypes, etc, and when they actually want to ship it, you get them to get their own developer program license.

请注意,这不允许您将应用程序分发到应用程序商店,但如果您是一家为客户构建大量应用程序的开发公司,它可能会大大简化您的“构建并发送给客户”过程!我不确定这是否在 Apple 的合法使用政策中,所以请在考虑该选项之前检查一下。但它可能是原型等需要考虑的事情,当他们真正想要发布它时,你会让他们获得他们自己的开发者程序许可。

回答by Vineeth

I have been trying to make this work for sometime. Finally made it!!

一段时间以来,我一直在努力使这项工作发挥作用。终于成功了!!

Can use fastlane sigh to download and install only the provisional profile you need.

可以使用 fastlane sigh 仅下载和安装您需要的临时配置文件。

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

Note : This command needed any provisional profile of the app already installed in the system. It thrown error for me otherwise.

provisional_profile_name = Just the name of the profile name, doesn't need extension.

注意:此命令需要系统中已安装的应用程序的任何临时配置文件。否则它会为我抛出错误。

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

回答by Heath Borders

Sighcan manage provisioning profiles for you. However, it doesn't support installing profiles that you've fetched yourself already. However, I still found it valuable to look at their source for how they actually install a profile once they've downloaded it.

Sigh可以为您管理配置文件。但是,它不支持安装您已经获取的配置文件。但是,我仍然发现查看他们的来源以了解他们在下载配置文件后如何实际安装配置文件很有价值

Thankfully, it's very similar to James J's answer:

值得庆幸的是,它与James J 的回答非常相似:

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

I have a script to perform this local installation for me:

我有一个脚本可以为我执行此本地安装:

#!/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

which depends on another uuid-from-mobileprovision.bashscript:

这取决于另一个uuid-from-mobileprovision.bash脚本:

#!/bin/bash -euo pipefail

if [ ! -f "" ]
then
  echo "Usage: ##代码## <path/to/mobileprovision/file>" 1>&2
  exit 1
fi

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

回答by coffeebreaks

Try using apple_dev_center.rb from https://github.com/lacostej/apple-dev

尝试使用https://github.com/lacostej/apple-dev 中的apple_dev_center.rb

It parses the info from the apple developer web site and download the profiles for you to copy them to the proper location automatically.

它解析来自苹果开发者网站的信息并为您下载配置文件以自动将它们复制到适当的位置。