生成自签名开发证书算法
1. 启动证书链管理工具(应用程序->实用工具->钥匙串访问)建立证书
1. 设置证书名称设置为iPhone Developer(该名称须要和XCode编译签名时使用的证书名称一致,下文会提到),身份类型选择自签名根证书,证书类型选择S/MIME (电子邮件),而且在覆盖这些默认值选项上打勾。
选择继续制做自签名证书
2. 设置证书有效期365天(时长不要超过365天)
3. 输入用户信息
4. 选择密钥大小和算法(2048位和采用RSA算法)
5. 设置密钥扩展功能(选择签名功能和代码签名功能)
6. 禁止基本约束扩展
7. 设置主题设备用名称扩展,RFC822输入邮箱便可
8. 设置钥匙串类型为登录类型
至此,自签名证书建立完毕bash
Xcode破解app
保证Xcode处于关闭状态,命令行终端,复制粘贴下面的代码:curl
#!/bin/bashiphone
cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS/ Build/ System/ Support.xcplugin/Contents/MacOS/工具
dd if=iPhoneOS/ Build/ System/ Support of=working bs=500 count=255ui
printf “/x8f/x2a/x00/x00″ >> workingurl
dd if=iPhoneOS/ Build/ System/ Support of=working bs=1 skip=127504 seek=127504.net
/bin/mv -n iPhoneOS/ Build/ System/ Support iPhoneOS/ Build/ System/ Support.original命令行
/bin/mv working iPhoneOS/ Build/ System/ Support
chmod a+x iPhoneOS/ Build/ System/ Support
而后复制粘贴下面的代码到命令行终端:
mkdir /Developer/iphoneentitlements30
cd /Developer/iphoneentitlements30
curl -O http://www.alexwhittemore.com/iphone/gen_entitlements.txt
mv gen_entitlements.txt gen_entitlements.py
chmod 777 gen_entitlements.py
./gen_entitlements.py
执行完脚本后修改”/Developer/Platforms/iPhoneOS.platform/Info.plist”文件,作以下修改:
新增以下两项(告知项目编译无需证书):
PROVISIONING_PROFILE_ALLOWED = NO
PROVISIONING_PROFILE_REQUIRED = NO
共两处须要修改,以下所示:
<key>ARCHS</key>
<string>armv6</string>
<key>CODE_SIGN_CONTEXT_CLASS</key>
<string>XCiPhoneOSCodeSignContext</string>
<key>COMPRESS_PNG_FILES</key>
<string>YES</string>
<key>DEBUG_INFORMATION_FORMAT</key>
<string>dwarf-with-dsym</string>
<key>EMBEDDED_PROFILE_NAME</key>
<string>embedded.mobileprovision</string>
<key>INFOPLIST_OUTPUT_FORMAT</key>
<string>binary</string>
<key>NATIVE_ARCH</key>
<string>armv6</string>
<key>PLIST_FILE_OUTPUT_FORMAT</key>
<string>binary</string>
<strong><key>PROVISIONING_PROFILE_ALLOWED</key>
<string>NO</string>
<key>PROVISIONING_PROFILE_REQUIRED</key>
<string>NO</string></strong>
<key>SDKROOT</key>
<string>iphoneos2.2.1</string>
<key>STRINGS_FILE_OUTPUT_ENCODING</key>
<string>binary</string>
<key>CODE_SIGN_CONTEXT_CLASS</key>
<string>XCiPhoneOSCodeSignContext</string>
<key>DEBUG_INFORMATION_FORMAT</key>
<string>dwarf-with-dsym</string>
<key>EMBEDDED_PROFILE_NAME</key>
<string>embedded.mobileprovision</string>
<key>SDKROOT</key>
<string>iphoneos2.2.1</string>
<strong><key>PROVISIONING_PROFILE_ALLOWED</key>
<string>NO</string>
<key>PROVISIONING_PROFILE_REQUIRED</key>
<string>NO</string></strong>
加粗部分为要加入的内容。保存。
而后将该文件中全部的”XCiPhoneOSCodeSignContext”替换为”XCCodeSignContext”,即去掉中间的”iPhoneOS” 。若是不进行此步,编译Device Release版本时會报错:
Code Sign error: a valid provisioning profile matching the application’s Identifier ‘com.yourcompany.xxxx’ could not be found
1. 使用XCode打开你的项目文件,在Project->Edit Project Setting中选择Build页面,找到Code Signing Identifty选项,将签名设置成iPhone Developer
2. 而后找到你项目的xxx-Info.plist文件,添加”SignerIdentity”项,其值为”Apple iPhone OS Application Signing”.保存。[我加了这一步编译时就总出错,不加没问题,不知道为啥子。。。]
Xcode破解完成,或者更准确的讲,是配置完成!
Xcode真机调试
将 iPhone接入电脑,在Xcode的Window->Organizer中会侦测到你的iPhone.查看iPhone和你的Xcode识别正常后退出Organizer,选择编译环境为”iPhone Device-4.2|Release”,点击”Build and Go”,期间会出现让咱们选择签名证书,点选”容许”后,等待你的iPad/iPhone屏幕点亮就ok了。
你的程序会自动下载到你的iPhone中,能够进行真机调试了。
Xcode升级破解
若是是在原Xcode的版本上升级到3.2.5,而且以前已经破解过,那么只须要再作以下步骤便可:
新增以下两项(告知项目编译无需证书):
PROVISIONING_PROFILE_ALLOWED = NO
PROVISIONING_PROFILE_REQUIRED = NO
而后将该文件中全部的”XCiPhoneOSCodeSignContext”替换为”XCCodeSignContext”,即去掉中间的”iPhoneOS” 。若是不进行此步,编译Device Release版本时會报错:
Code Sign error: a valid provisioning profile matching the application’s Identifier ‘com.yourcompany.xxxx’ could not be found