zoukankan      html  css  js  c++  java
  • (转)图文并茂 在ML OS X 10.8 + XCode4.4/4.4.1下实现无证书真机调试IOS5.1.1(亲测,附调试截图)

    我的化妆水网站http://hhheroyuan.52.xindns4.info

    本方法是结合网上一些朋友的帖子,然后加上自己的理解写的,在ML OS X 10.8环境下用XCode4.4/4.4.1 + IOS5.1实测可行!

    ps:使用无证书调试,也意味着你的设备要越狱!

     

    第一步:制作证书

    1)打开   Finder->应用程序->实用工具 ->  钥匙串访问 

    2)单击:"钥匙串访问"选择  "证书" 再选择"创建证书"过程如下图:

    注意:证书名称必须填写为 iPhone Developer

     

    第二步:修改XCode配置文件

    注:如遇到文件无法解锁没有权限不能修改,可以复制一份出来,修改好之后将原来的替换掉

    1)修改SDKsettings.plist文件

    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk

    打开该目录下的SDKSettings.plist文件,把CODE_SIGNING_REQUIRED和ENTITLEMENTS_REQUIRED的值改成NO

    2)修改Info.plist文件

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

    用XCode打开该目录下的Info.plist文件,右击--Add Row,增加两项:

    PROVISIONING_PROFILE_ALLOWED 值为 NO

    PROVISIONING_PROFILE_REQUIRED 值为 NO

    3)将上面Info.plist文件中的 "XCiPhoneOSCodeSignContext" 替换成 "XCCodeSignContext"(共3处)

    第三:设置gen_entitlements.py脚本权限

    注:如果你的电脑联网了,那么执行1)的命令后会在相应的目录自动创建iphoneentitlements文件夹及其下的gen_entitlements.py文件,如执行后没有生成指定文件,请重复执行下面的命令或者换第二种方法,两种生成脚本文件的方法任选一种。

    1)在终端执行如下命令:

    复制代码
    mkdir /Applications/Xcode.app/Contents/Developer/iphoneentitlements
    
    cd /Applications/Xcode.app/Contents/Developer/iphoneentitlements
    
    curl -O http://www.alexwhittemore.com/iphone/gen_entitlements.txt
    
    mv gen_entitlements.txt gen_entitlements.py
    sudo chmod 777 gen_entitlements.py
    复制代码

    2)上面的命令执行成功之后,会在/Applications/Xcode.app/Contents/Developer/目录下生成一个iphoneentitlements文件夹和其下的gen_entitlements.py文件,如果你的电脑没有联网或者不能自动生成相关目录文件,那么需要手动在相应的目录创建指定的文件,随后需要给gen_entitlements.py设置权限。

    gen_entitlements.py脚本文件的内容如下:

    复制代码
    #!/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()
    复制代码

    在终端给gen_entitlements.py设置权限(可能会要你输入密码)

    sudo chmod 777 /Applications/Xcode.app/Contents/Developer/iphoneentitlements/gen_entitlements.py

    第四步:修改项目属性

    1)点击项目图标,找到"Build Settings"选项下的"Code Sign Identity",将其值全部改为"Don't Code Sign"

    2)切换到Build Phases选项,点击右下角的Add Build Phase,然后单击Add Run Script,然后在Run Script中输入以下脚本:

    复制代码
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
    
    if [ "${PLATFORM_NAME}" == "iphoneos" ] || [ "${PLATFORM_NAME}" == "ipados" ]; then
    
    /Applications/Xcode.app/Contents/Developer/iphoneentitlements/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
    复制代码

     

    第五步:连接设备(iphone/ipad)

    点XCode右上角的Organizer图标,然后选中你的设备,在右边窗口中点击“Use for Development” 即可,此时你的设备名称旁边应该显示黄色的小灯,重新拔插数据线,Organizer中会出现一个进度条,等这个进度条跑完,小灯就会变成绿色,开发模式已经启用。

     

    测试真机调试

    创建一个Page-based Application工程,修改Build Settings和Build Phases下面的相关配置(参考第四步)

    1)选择你的设备

    2)随便拖一个button,然后点击运行(Run)

    3)iphone运行效果截图

  • 相关阅读:
    SQl 事物+视图+游标+索引+锁
    常用经典SQL语句大全完整版--详解+实例 《来自网络,很全没整理,寄存与此》
    SQL--存储过程+触发器 对比!
    SQL---触发器
    SQL (一)定义变量以及变量赋值
    Js 事件大全
    ASP.NET 常用内置对象详解-----Response
    母板页----路径问题
    构建低代码开发生态,APICloud全面进入3.0时代
    APICloud:云端服务开发的硬核要素
  • 原文地址:https://www.cnblogs.com/liuhaili/p/3050318.html
Copyright © 2011-2022 走看看