XCode4.3.3/4.2/4.3 + iOS5.1 无证书开发 、真机调试、生成IPA

原文:

环境:

Mac OS X 10.7.4+XCode4.3.3+ iPad3

特别说明:

Xcode4.3.2 , Xcode4.3.3 都是免安装的,打开dmg后,只有一个Xcode.app文件。安装方法是直接将Xcode.app拖放到“应用程序”(Applications)的目录即可使用。安装后没有Developer目录,所以以下的制作方法也是Xcode.app的安装包中进行的。

而xcode4.1/xcode4.2,则是安装到/Developer/目录下,从该目录下去找相应的文件。

另外,你的iPhone或iPad必须越狱的。

1、生成iPhone Developer证书

在“使用工具”中使用 “钥匙串访问” 工具,“钥匙串访问->证书助理->创建证书”名称必须写成 “iPhone Developer”其他全部默认,直至证书生成完成。

2、修改XCode系统文件

cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdksudo vim SDKSettings.plist此时进入vim文件编辑状态(会提示password 输入Mac登陆密码后回车)

其它版本,进入:

(Xcode4.5请执行)cd/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk(注:i 进入Insert状态,修改完成后按ESC键退回到命令状态,Q退出 :w 保存 :q 退出)

将下面两个字段修改为NO<key>CODE_SIGNING_REQUIRED</key><string>YES</string><key>ENTITLEMENTS_REQUIRED</key><string>YES</string>

其它版本该文件所在的位置:

(Xcode4.1) cd /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/(Xcode4.2)cd /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/(Xcode4.3)cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

(Xcode4.3.2)cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk

(2.2) 进入另外一个目录

cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform

进行编辑:

sudo vim Info.plist

将全部的XCiPhoneOSCodeSignContext 修改成 XCCodeSignContext。保存退出即可。

(提示:在vim中输入/要搜索的内容来搜索,按n键是搜索下一处。)

其它版本该文件所在的目录:

(Xcode4.1/4.2)cd /Developer/Platforms/iPhoneOS.platform/(Xcode4.3/4.3.2)cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform

3、增加文件gen_entitlements.py

cd /Applications/Xcode.app/Contents/Developer/

mkdir iphoneentitlements(如果创建失败可直接通过Finder 前往 /Applications/Xcode.app/Contents/Developer/手动去创建此文件夹)

cd iphoneentitlementscurl -O (通过网站下载了一个文件)mv gen_entitlements.txt gen_entitlements.py

chmod 777gen_entitlements.py

如果没有连接网络的,那么请在相应目录手动创建gen_entitlements.py并授予其执行权限,这个文件的内容为:

#!/usr/bin/env pythonimport sysimport structif len(sys.argv) != 3:print "Usage: %s appname dest_file.xcent" % sys.argv[0]sys.exit(-1)APPNAME = sys.argv[1]DEST = sys.argv[2]if not DEST.endswith(‘.xml’) and not DEST.endswith(‘.xcent’):print "Dest must be .xml (for ldid) or .xcent (for codesign)"sys.exit(-1)entitlements = """<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ""><plist version="1.0"><dict> <key>application-identifier</key> <string>%s</string> <key>get-task-allow</key> <true/></dict></plist>""" % APPNAMEf = open(DEST,’w’)if DEST.endswith(‘.xcent’):f.write("\xfa\xde\x71\x71")f.write(struct.pack(‘>L’, len(entitlements) + 8))f.write(entitlements)f.close()

4、配置XCode项目

特别注意:本阶段之前的修改配置文件、准备脚本等,只需要做一次。

但本阶段的操作,对每个需要真机调试的工程都要做一遍。

(1)禁用Xcode自动的签名操作将工程配置中所有的Code Signing选项全部设为Don’t Code Sign,如图。可能需要先点击“All”让这个选项显示出来。如下:

(2)添加自定义的生成后脚本

但我自信,我能点亮心烛,化解心灵的困惑。

XCode4.3.3/4.2/4.3 + iOS5.1 无证书开发 、真机调试、生成IPA

相关文章:

你感兴趣的文章:

标签云: