讓 XCode 3.2 跳過 Provisioning profile

這次跟 3.1 相比是有點複雜,但不算太難。

  1. 首先到 /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk(視乎你要用哪一個 iPhone OS 的版本),把 SDKSettings.plist 備份然後打開修改。這個檔案應該不能用內置的 plist editor 來開啟,所以請用純文字編輯器來開啟。打開文件後尋找:

    <key>CODE_SIGNING_REQUIRED</key>
    <string>YES</string>

    把 YES 改成 NO。
    然後尋找:

    <key>ENTITLEMENTS_REQUIRED</key>
    <string>YES</string>

    同樣是把 YES 改成 NO。

  2. 移到 /Developer/Platforms/iPhoneOS.platform/,備份 Info.plist 然後打開修改。尋找以下將會出現三次的字串

    <key>CODE_SIGN_CONTEXT_CLASS</key>
    <string>XCiPhoneOSCodeSignContext</string>

    <string>XCiPhoneOSCodeSignContext</string>

    改成

    <string>XCCodeSignContext</string>

  3. 現在需要對 XCode 進行 binary patch,利用純文字編輯器輸入以下文字:


    #!/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
    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

    儲存至桌面,名字叫甚麼也可以,我叫它做 xcodepatch
    然後打開 terminal,移到桌面資料夾,輸入以下指令:

    chmod 777 xcodepatch
    ./xcodepatch

    如果成功,你會見到這樣的文字:

    255+0 records in
    255+0 records out
    127500 bytes transferred in 0.020355 secs (6263821 bytes/sec)
    189216+0 records in
    189216+0 records out
    189216 bytes transferred in 1.200354 secs (157633 bytes/sec)

  4. 開一個新的 project,在選單中點選 “Project > Edit project settings",在 “Code Signing Identity" 及它的子項目 “Any iPhone Device" 都選 “Don’t Code Sign"。
  5. 再次打開 terminal,輸入:


    mkdir /Developer/iphoneentitlements312
    cd /Developer/iphoneentitlements312
    curl -O http://www.alexwhittemore.com/iphone/gen_entitlements.txt
    mv gen_entitlements.txt gen_entitlements.py
    chmod 777 gen_entitlements.py

    XCode 的 patch 做好了。

  6. 接下來這個步驟是 **** 每一個 project 都要做的 ****,請記下來。

    開啟 project 後,在選單中選 “Project > New Build Phase > New Run Script Build Phase",然後輸入:


    export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
    export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
    if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
    /Developer/iphoneentitlements312/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

資料來源:
Developing for a Jailbroken iPhone A to Z (iPhone 3.1.2)

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s