使用Ad Hoc 打包进行用户测试
在完成iOS开发,准备进行发布之前,我们都希望App能在周围的朋友之间先进行测试,提提意见,修改完善之后再发布到App Store上。Apple考虑到这一点,因此通过Ad Hoc来实现发布前的用户测试。从另一个角度讲也就是通过Ad Hoc 将未发布的App 给其他人提前免费使用。
App证书分为两种:开发证书、发布证书。然App发布证书分:AppStore(正常的发布到商店) 及 Adhoc(内部测试发布) 两种。
如果手机在开发人员附近,也就是我周围,那么我就用开发证书给他装上啦(就是手机通过数据线连接上电脑进行真机调试,把app安装到手机上),如果不在开发人员附近,那就得用到Ad hoc 方式来安装(打包后生成iTunes识别的ipa文件,安卓的识别apk文件)。
(如果想要将做的iOS应用程序安装到自己的iOS设备上测试、或者安装到别人的iOS设备上,或者想发布到App Store中,先要给应用签名。签名就要有证书,这就需要申请证书的过程了。
把自己的应用程序安装到设备中,主要有一下几种方式:
1、 把iOS设备与电脑连接起来,如果Xcode中已经添加了包含这个设备的Profile文件且在工程中已经选择了该文件,那么在Xcode左上角便可以选择这个设备,之后点击RUN,程序就被安装在这个iOS设备中了。这个主要用于在真机上测试程序。
2、 使用Xcode将应用程序以Ad Hoc方式打包,到处ipa文件,然后用iTunes等工具将应用程序安装到iOS中。这种方式的Profile文件主要是Ad Hoc类型,并且包含制定的设备信息。导出的ipa也只能安装到制定的设备中。
3、将应用程序发布到App Store上,待苹果审核通过后,其他人就可以下载安装了。
本文主要讲第二种方法Adhoc这种方式。(必备条件:开发者账号,手机,电脑)
制作Profile文件需要经过“添加证书—添加App ID—添加设备—制作Profile文件”四个步骤,下面将分别进行介绍。)
一、添加证书
![](https://img.haomeiwen.com/i1378846/febc2e3634db59e5.png)
![](http://upload-images.jianshu.io/upload_images/1378846-13478d6a9b3410f7.png)
点击右上角的+号
![](http://upload-images.jianshu.io/upload_images/1378846-5a3fe9a9b160b703.png)
![](http://upload-images.jianshu.io/upload_images/1378846-f38c4103e504b993.png)
![](http://upload-images.jianshu.io/upload_images/1378846-57577fe85255988b.png)
接下来要制作一个CSR文件
首先打开钥匙串
![](http://upload-images.jianshu.io/upload_images/1378846-87c9fc4f7aeb574e.png)
![](http://upload-images.jianshu.io/upload_images/1378846-aa1a8cac19a6999a.png)
![](http://upload-images.jianshu.io/upload_images/1378846-d78721605dc355dc.png)
![](http://upload-images.jianshu.io/upload_images/1378846-7f42628b2cdf02af.png)
![](http://upload-images.jianshu.io/upload_images/1378846-2b2d2bec1482ebe4.png)
证书制作完成
二、添加App ID
![](http://upload-images.jianshu.io/upload_images/1378846-05fe089540c3444b.png)
下面此处的Bundle ID一定要和x-code---TARGETS-General的Bundle Identifier的名字一样
![](http://upload-images.jianshu.io/upload_images/1378846-05bb1fe71313d135.png)
![](http://upload-images.jianshu.io/upload_images/1378846-d59c2fa4e5247662.png)
三、添加设备
可以全包括你的已经有的设备,udid就是你的手机的识别标示,必须包含你的手机的udid,不然安装不上。
![](http://upload-images.jianshu.io/upload_images/1378846-52039cdde5370473.png)
四、制作Profile(配置)文件
![](http://upload-images.jianshu.io/upload_images/1378846-4c25383d587c9a6b.png)
![](http://upload-images.jianshu.io/upload_images/1378846-9470839b0aacff29.png)
![](http://upload-images.jianshu.io/upload_images/1378846-ba080c218316f41e.png)
![](http://upload-images.jianshu.io/upload_images/1378846-235e6254326cd24a.png)
五、Ad_Hoc方式打包
打开x-code后,双击上面你的配置文件(Profile(配置)文件)
下图中一定要选择真机(都是坑),不然product-Archive是灰色,无法选择
![](http://upload-images.jianshu.io/upload_images/1378846-7f23881434bc641c.png)
![](http://upload-images.jianshu.io/upload_images/1378846-a290f52a3b406997.png)
![](http://upload-images.jianshu.io/upload_images/1378846-bde57c118e81e87a.png)
接下来就可以在桌面看到你的ipa文件了,发送给上海的朋友,安装在他的手机上
上海的朋友 手机的udid 也必须在你添加的设备中,不然一样无法安装ipa
![](http://upload-images.jianshu.io/upload_images/1378846-e61f8b86cb330293.png)
![](http://upload-images.jianshu.io/upload_images/1378846-3167a8b0a46d65cb.png)
用iTunes就可以把ipa文件安装到手机上,
![](http://upload-images.jianshu.io/upload_images/1378846-4f9e32c91c375c75.jpg)
若有不明白的可以call我!!!!!!