iphone 无证书真机调试
参考:http://www.alexwhittemore.com/?p=398
开发环境
Mac 10.6.6
xcode4
iphone4
ios4已越狱
在cydia中安装
Appsync
重启iphone
在mac用文本编辑打开
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.sdk/SDKSettings.plist
找到
<key>CODE_SIGNING_REQUIRED</key>
<string>YES</string>
将下面的改为<string>NO</string>
找到
<key>ENTITLEMENTS_REQUIRED</key>
也将下面的YES改为NO
在mac用文本编辑打开
/Developer/Platforms/iPhoneOS.platform/Info.plist
找到
<key>CODE_SIGN_CONTEXT_CLASS</key>
<string>XCiPhoneOSCodeSignContext</string>
共有两处
都将第二行改为
<string>XCCodeSignContext</string>
如果修改后不可以保存,试着用sudo vi或拉到桌面改完再拉回去(要输入密码)
打开控制台
输入
cd ~/Desktop
vi script
#!/bin/bash
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=255
printf "\xc3\x26\x00\x00" >> working
/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
再按”:” “x” 回车,保存
接着输入来执行脚本
chmod 777 script
./script
控制台显示下面的文字表示成功
$ ./script
223+1 records in
223+1 records out
111648 bytes transferred in 0.002678 secs (41692099 bytes/sec)
在xcode打开你的项目,或新建一个ios项目
点击项目名字的PROJECT -> BuildSettings
设置Code Signing Identity
Debug和Release为Don’t Code Sign;
-----如果不调试,下面的步骤好像都没用的,直接跳最后去执行就可以了。----
注意:调试只用于iphone3gs可以,4好像都不行。
在控制台执行下面的代码
在Developer下新建目录,下载gen_entitlements.txt并改名为gen_entitlements.py
1. mkdir /Developer/iphoneentitlements401
2. cd /Developer/iphoneentitlements401
3. curl -O http://www.alexwhittemore.com/iphone/gen_entitlements.txt
4. mv gen_entitlements.txt gen_entitlements.py
5. chmod 777 gen_entitlements.py
我执行curl –O不成功,没有下载,只是显示出来了。
所以我手动在浏览器打开上面的网址,并用vi新建一个gen_entitlements.py并拷贝代码进去。
再执行chmod 777 gen_entitlements.py
下面这句我不知道有没有用
Plug your iPhone in and open Xcode. Open Window>Organizer. Select the device from the list on the left hand side, and click "Use for development." You'll be prompted for a provisioning website login, click cancel. It's there to make legitimate provisioning easier, but doesn't make illegitimate not-provisioning more difficult.
不过我是执行了,我是在这个地方找到的
最后文章说,如果要iphone可调试,要在你的项目打开
Project > New Build Phase > New Run Script Build Phase
并添加下面脚本代码
export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
/Developer/iphoneentitlements401/gen_entitlements.py "my.company.${PROJECT_NAME}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent";
codesign -f -s "iPhone Developer" --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
fi
不过这个调试只用于iphone3gs
Iphone4的调不了。
所以这个东东gen_entitlements.txt好像不用去下载它。
因为只有在要调试的时候才用到.
插入iphone4
打开xcode,打开项目,
在Scheme会看到你的iphone Device,选它。
点Run
运行会出错。
等显示出错后点确定关掉出错的窗口就行。
在iphone4上手动打开你的软件就可以运行了。
Enjoy it.