iPhone 3.0 + SDK 3.0 真机调试 免IDP

来源:互联网 发布:服务贸易进出口数据 编辑:程序博客网 时间:2024/04/27 23:11

经过看网上的资料,和我几个小时的试验,已经成功,联机调试.
环境:pc+mac os 10.5.7+sdk3.0(xcode 3.13,iphone3.0 7A341),iphone 用官方3.0+越狱.

1.在之前的2.x版本下,我一般编译程序到机子的做法是修改xproject去掉iPhone Developer的方法,(参考http://www.cocoachina.com/bbs/read.php?tid-1822-fpage-4.html)
如果以前这样修改过xproject文件的,要先恢复到原始状态,把iPhone Developer那句话加回去(随意找个2.x时期的官方sample就有)
2.制作自己的证书,制作方法参考http://www.weiphone.com/thread-222380-1-1.html,说明的是,最后的存放位置据说应该是登录(login)而不是系统,反正我现在用的就是登录.
3.打开终端,执行如下代码,这个是XCode的补丁,因为在3.13的xcode修补了3.12的免签名漏洞,打这个补丁才行
#!/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 "/x8f/x2a/x00/x00" >> working
dd if=iPhoneOS/ Build/ System/ Support of=working bs=1 skip=127504 seek=127504
/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

或者你懒的去执行,也可以下载这个文件(要解压下)   patch.sh.zip (1 K) 下载次数:103 放在用户根目录,执行
sudo sh ./patch.sh

4.在终端执行如下命令

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

5.XCode中打开你的project,在菜单project->New Build Phase > New Run Script Build Phase,那个script空白框,拷贝如下代码进去

export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
    /Developer/iphoneentitlements30/gen_entitlements.py"my.company.${PROJECT_NAME}""${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent";
    codesign -f -s "iPhone Developer" --resource-rules "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/ResourceRules.plist" /
         --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent"  "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
fi


6.修改"/Developer/Platforms/iPhoneOS.platform/Info.plist"文件,默认是用Property List Editor打开,然后添加:
PROVISIONING_PROFILE_ALLOWED = NO
PROVISIONING_PROFILE_REQUIRED = NO

7.在你的project的info.list里面增加一行,也就是你之前步骤2建的自定义的证书名字啦.
SignerIdentity=iPhone Developer

8.把你的iphone连接到电脑,提示连接成功,后 xcode菜单,window->Organizer里面,把iphone设为调试设备.
对了,我忘记了我做的一个步骤,不知道是不是必须的,这里补上
9.iphone要安装MobileInstallation Patch ,安装步骤:打开cydia,进入manage->sources->edit->Add,在网址输入框里面输入www.iphone.org.hk/adp/
完成后,进入sources 可以看到www.iphone.org.hk这个网站,然后进去,可以找到MobileInstallation Patch,点击安装即可.
安装完成重启手机.

以上步骤,并非按顺序做,只是充分条件,我没有完全测试,可能有些步骤不是必须的,大家可以根据自己的实际情况来看.

参考资料:
(中文部分)
1,http://www.weiphone.com/thread-394723-1-1.html(这个较早,3.12版本,也比较复杂,不建议使用)
2,http://www.weiphone.com/thread-421187-1-1.html(后续,3.13版本的xcode,不完整,不能联机调试,其实这个教程加上我所说的步骤4应该可以了调试)
(英文部分)
http://www.alexwhittemore.com/?p=270
http://www.iphonedevsdk.com/forum/iphone-sdk-tools-utilities/20983-sdk-3-0-xcode-3-1-3-build-go-jailbroken-device.html

 

以上部分来自于:http://www.cocoachina.com/bbs/read.php?tid-6040.html

---------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------

iPhone 3.0 + SDK 3.0  Device Debug without dev account

step1:Create a Self-Signing Identity. Named "iPhone Developer".

step2:Open your project and go to (menu) Project > Edit Project Settings. In the list of properties, find “Code Signing Identity” > “Any iPhone OS Device” and put "iPhone Developer" in this field.

step3:Add the special 3.0 sauce:
   1. Open a terminal.
   2. type cd ~/Desktop (enter)
   3. type vi script (enter)
   4. tap i on your keyboard (to enter “insert” mode in vi).
   5. Copy/Paste (cmd-v) the following code into your terminal window:
      #!/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 "/x8f/x2a/x00/x00" >> working
      dd if=iPhoneOS/ Build/ System/ Support of=working bs=1 skip=127504 seek=127504
      /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
   6. type ESC, then : x (colon,x) (enter). This saves and exits in vi.
   7. type chmod 777 script (enter)
   8. type ./script (enter) This will execute the script to patch the Xcode plugin. Assuming it completes correctly, you should be good to go, try it out!

step4:Codesign the binary before it hits the phone:
   1. mkdir /Developer/iphoneentitlements30
   2. cd /Developer/iphoneentitlements30
   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

step5:Add the build phase: in Xcode, select the menu options “Project > New Build Phase > New Run Script Build Phase”, and enter the following script:
export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
    /Developer/iphoneentitlements30/gen_entitlements.py "my.company.${PROJECT_NAME}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent";
    codesign -f -s "iPhone developer" --resource-rules "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/ResourceRules.plist" /
         --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent"  "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
fi

NOTE: You will have to repeat  step5 for every project! (That is, the add build phase part, not the terminal part.) It’s a bummer, but I’m not sure there’s any way around it. I’ll try to figure out if you can persist custom build phases across projects.

over, enjoy it !
--------------------------------------------------------------------------------------------------
--script file--------------------------------------------------------------------------------------
 #!/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 "/x8f/x2a/x00/x00" >> working
      dd if=iPhoneOS/ Build/ System/ Support of=working bs=1 skip=127504 seek=127504
      /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


--gen_entitlements.txt file----------------------------------------------------------------------
#!/usr/bin/env python

import sys
import struct

if 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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>application-identifier</key>
    <string>%s</string>
    <key>get-task-allow</key>
    <true/>
</dict>
</plist>
""" % APPNAME

f = 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()

------------------------------------------------------------------------------------------------------------------------------------------------------

from:http://www.alexwhittemore.com/?p=270

原创粉丝点击