Provide xcodebuild with .mobileprovision file

匿名 (未验证) 提交于 2019-12-03 00:48:01

问题:

I am setting up Jenkins for automating iOS builds. Are there any possibility to provide a .mobileprovision file that is not added to the provisioning tool in Xcode to xcodebuild?

I know that I can use PROVISIONING_PROFILE and PROVISIONING_PROFILE[sdk=iphoneos*] but they require the provisioning profile to be added to the Organizer.

I know that I can do the operation with xcrun. But before running xcrun I must successfully sign the app with xcodebuild.

Is there any way that I can just provide the provisioning profile file (.mobileprovision) to xcodebuild?

回答1:

We have a solution for this - essentially what you need to do is to 'install' the .mobileprovision file by copying it to a directory named after the UUID of the mobile provision file. This is what the Xcode Organizer actually does when you double-click a .mobileprovision file.

There's a little program called mpParse that can extract the UUID from the mobileprovision file that the script uses - link for download in the code. Then it's dead simple to copy the mobileprovision file to the correct place.

Here's a shell script I made to do this:

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

You can download the script direct from https://gist.github.com/2568707

Once you've run the script, you can use PROVISIONING_PROFILE and PROVISIONING_PROFILE[sdk=iphoneos*] in xcodebuild to create your app. We use this in production.

Edit: Just for reference, I asked essentially this question here a little while back ( Can an Xcode .mobileprovision file be 'installed' from the command line? ) and came up with the above when no-one seemed to know :-)

Update: As an alternative to mpParse one could use apple tools: /usr/libexec/PlistBuddy -c 'Print UUID' /dev/stdin



回答2:

If you use sigh from fastlane you can assign it's output to a variable provision_id=sigh

this also works if sigh has params: sigh(...)

This is the only script that worked for me:

`var=$(grep UUID -A1 -a | grep -io "[-A-Z0-9]{36}")'

use with: "$var.mobileprovision"



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!