Using xcodebuild To Export a .ipa From an Archive

Xcode 6 changes how you export a .ipa from an archive for adhoc distribution. It used to be that you could export the archive to a .ipa as long as you had the right provisioning profile and distribution certificate on your machine. Starting with Xcode 6 you need to be a team member of the particular Developer Program account and you need to have the rights to make a distribution build. This means you need to be a team agent. However, I work with a number of clients who don’t have the clue what Xcode is much less are willing to make distribution builds, so I need to way to make distribution builds within this new limitation from Xcode 6.

Making distribution builds hasn’t been a problem for me in the past. I ask the client to provide me1 with the necessary provisioning profile, distribution certificate, and public private key pair so I can make the distribution build for them. Then I use Xcode Organizer to export the archive to a .ipa that I can distribute.2 But it seems I can no longer export using Organizer without having the right team access, so I had to search out an alternative approach.

Turns out starting with Xcode 5, xcodebuild includes parameters for exporting from an archive. This is exactly what I need so I can continue making adhoc distribution builds for clients without being a team member or team agent under their Developer Program account.

So how do I do it?

The How To

My build script starts by performing a clean.

xcodebuild clean -project $projectname.xcodeproj -configuration Release -alltargets

Then the script builds and archives the app. I specify the archive path using the -archivePath parameter in the command line so the script will know where the archive file is located.

xcodebuild archive -project $projectname.xcodeproj -scheme $schemename -archivePath $projectname.xcarchive

Finally my script exports the archive into a .ipa file.

xcodebuild -exportArchive -archivePath $projectname.xcarchive -exportPath $projectname -exportFormat ipa -exportProvisioningProfile “Provisioning Profile Name”

I let the provisioning profile imply the signing identity, but you can specify the signing identity using the -exportSigningIdentity parameter.

The Gotcha

The one major gotcha that cost me a more than an hour of time was figuring out the parameter value for -exportProvisioningProfile. I initial thought it should be the file name to the provisioning profile. I tried it with and without the .mobileprovision file extension, but it did not work. I included a relative path as well as an absolute path to the provision profile. I tried using the UUID for the provision profile instead of the file name. I even I tried not including a path at all thinking it would look up the provision profile in the ~/Library/MobileDevice/Provisioning Profiles/ directory, but still no luck.

Turns out I needed to specify the name of the provisioning profile as defined in the file itself. This is the same name assigned to the profile in the provisioning portal. Once I figured this out I was able to export the .ipa from the archive using the my build script, and I don’t have to be a team agent under my client’s Developer Program account to make the distribution build.

  • I usually assist my clients with this by guiding them through the steps, or I ask them to give me the account credentials with a temporary password so I can perform the necessary steps. Then I have the client reset the password. ?
  • I don’t export when I host the test app on HockeyApp. It takes care of exporting the .ipa from the archive for you. I only export when the client requests that the test app be hosted on their own server.) ?
时间: 2024-10-27 13:46:43

Using xcodebuild To Export a .ipa From an Archive的相关文章

如何使用Shell脚本编译生成Archive文件并导出签名IPA文件。

1. build 脚本说明 本Shell脚本用于build,XCode的workspace源代码工程,并导出成可重签名的IPA文件,用于分发测试安装文件和用于提交appstore审核的文件.实现辅助产品开发,测试的配置管理工作. 使用本脚本需要以下环境 - Mac OS 10.9+ - XCode 6.0 or later and command line tools - 用于WorkSpace工程,例如使用了Cocoapods依赖库管理的工程 - *配置好开发证书和ad ho 证书(for D

Building Xcode iOS projects and creating *.ipa file from the command line

For our development process of iOS applications, we are using Jenkins set up on the Mac Mini Server, acting as a Continuous Integration (CI) server. It’s fairly easy to configure Jenkins for Xcode projects using Xcode Plugin - however, from time to t

使用XCode6.0.1将Cocos2d-x3.1工程打包ipa(支持iOS8)

据说iOS8需要使用XCode6.1打包,因为还未升级,暂时研究了几天,先把笔记整理下,以备以后使用方便,由于本人没有iphone,没有苹果企业证书,所有的东西都是东拼西凑的,所以打包成的ipa没有真机测试.如果失败,那只有再研究了. 因为需要升级之前3.1工程的项目支持iOS8,这两天暂时研究了一下ipa的打包(之前都是别人弄的,第一次自己打包,还是很费劲)所有,就有了这篇文章,如果可能,让大家少走弯路,把时间尽可能多得放在写代码上,不过还得吐槽一下:苹果搞这一套真是费事费力. 1.问题1:3

Xcode6.1 发布 出现 The ipa is invalid. It does not include a Payload Directory 错误

尝试搜索了网上的解决方案,均没有结果,于是自己想出了一种方案,试了试居然搞定了. 方法为:通过普通的archieve方式export出ipa包,然后将此包解压缩,把其中的Applications文件夹中的应用程序复制出来,然后新建一个文件夹叫Payload,然后将刚才的应用程序复制到该文件夹中,然后打包该文件成.zip文件,并修改后缀名成ipa,然后将此包通过Application Loader上传即可. 猜测可能是xcode6的bug,可能是自己生产ipa包的时候没有使用Payload文件夹.

同步推上传破解ipa方法

今天运营同事要求把已经上架到appStore,上传到同步推市场(tui.tongbu.com),在使用过程,感觉是无从下手,官方上没有任何文档,问客服也是爱搭不理,给他们提个建议也是很差的态度,来了句我们不支持.上传到同步推应用市场要的ipa文件必须是破解的,下面就来说下,也是记录下自己在使用过程遇到的些问题. 一.准备工作 系统OS X  Yosemite 10.10,Xcode6.1 ,越狱设备一台 二.破解Xocde 1.伪造签名证书: 打开实用工具-钥匙串访问.然后在菜单栏里点击钥匙串访

打包ipa出现问题记录

1.打包ipa事,Archive出现问题 解决方法:Xcode->系统偏好设置->Accounts->选中正在使用的账户->view details->download all,如下图:            

iOS自动化编译

http://www.cnblogs.com/brycezhang/p/4097487.html 最近研究了一下iOS的自动化编译,目的是为了简化测试和开发的同学沟通协调的次数,实现测试同学可以随时从网页操作编译SVN最新源码并打包ipa进行测试.具体思路是通过从配置文件读取需要编译的项目配置列表展示在网页上,测试同学选择需要编译的项目,确定后将选择项目的相关参数传入shell脚本运行,编译完成自动跳转至下载页面.主要流程包括: Shell脚本的编写.通过xcodebuild和xcrun实现自动

Mac Python sublimeText

https://www.cnblogs.com/corolcorona/p/6678197.html https://blog.csdn.net/olanlanxiari/article/details/48086917 https://blog.csdn.net/u014259820/article/details/81023224X https://docs.brew.sh/Homebrew-and-Python python -V python3 -V https://www.cnblog

ios app上架流程

时隔1年又让我鼓捣iOS,刚接手就是上架,经验值为0的我,虽然内心是拒绝的,但还是要接受这项任务滴!也就是在被拒后重新审核,再改在提交...这样反复的过程中也对上架流程熟悉了好多,写篇帖子送给同为菜鸟的你,如果里面有很菜的东西,大牛请自动忽略,毕竟这也是还为菜鸟的我的备忘录呢!    一.证书的导出      1.1 前期工作        首先你需要有一个苹果的开发者帐号,一个Mac系统.        如果没有帐号可以在打开http://developer.apple.com/申请加入苹果的