我如何在没有购买价值99美元的苹果证书的情况下,从Xcode将iPhone应用程序部署到真正的iPhone设备上?
我如何在没有购买价值99美元的苹果证书的情况下,从Xcode将iPhone应用程序部署到真正的iPhone设备上?
我使用了两个教程的混合:Jason 和 alex。第二个教程有调试的优势。我将主要复制两者的内容(并简化alex的):
2012年1月更新:这仍然适用于SDK 4.2.1和iOS 5.0.1 - 我刚在新电脑和设备上测试了所有内容!
修改您的iPhone SDK以允许使用该证书:
Launch Keychain Access.app. With no items selected, from the Keychain menu select Certificate Assistant, then Create a Certificate.
Click Continue
Click Continue
Blank out the Email address field.
Click Continue until complete.
You should see "This root certificate is not trusted". This is expected.
Set the iPhone SDK to allow the self-signed certificate to be used:
sudo /usr/bin/sed -i .bak 's/XCiPhoneOSCodeSignContext/XCCodeSignContext/' /Developer/Platforms/iPhoneOS.platform/Info.plist
If you have Xcode open, restart it for this change to take effect.
.
.
.
.
.
On your jailbroken iPhone, install the app AppSync by adding source ** http://repo.hackyouriphone.org**
Remove SDK requirements for code sign and entitlements (I'm loving sed!):
sudo /usr/bin/sed -i .bak '/_REQUIRED/N;s/YES/NO/' /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/SDKSettings.plist
Pay attention to the iPhoneOS5.0.sdk
part. If you're, for instance, using iOS 4.2 SDK, just replace it accordingly:
sudo /usr/bin/sed -i .bak '/_REQUIRED/N;s/YES/NO/' /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/SDKSettings.plist
Conclude the requirement removal through patching Xcode. This means binary editing:
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
If you have Xcode open, restart it for this change (and last one) to take effect.
Open "Project>Edit Project Settings" (from the menu). Click on the "Build" tab. Find "Code Signing Identity" and its child "Any iPhoneOS Device" in the list, and set both to the entry "Don't Code Sign":
After this feel free to undo step 3. At least in my case it went just fine.
Setting Xcode to code sign with our custom made self-signed certificate (the first how-to). This step can probably be skipped if you don't want to be able to debug:
mkdir /Developer/iphoneentitlements401
cd /Developer/iphoneentitlements401
curl -O http://www.alexwhittemore.com/iphone/gen_entitlements.txt
mv gen_entitlements.txt 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.
Now You have to do this last part for every new project you make. Go to the menu Project > New Build Phase > New Run Script Build Phase. In the window, copy/paste this:
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
.
.
.
.
第一部分:
sudo mv -f /Developer/Platforms/iPhoneOS.platform/Info.plist.bak /Developer/Platforms/iPhoneOS.platform/Info.plist
第二部分:
sudo mv -f /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/SDKSettings.plist.bak /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/SDKSettings.plist
sudo mv -f iPhoneOS\ Build\ System\ Support.original iPhoneOS\ Build\ System\ Support
如果您在步骤2的位置执行了步骤3,请相应地进行修改:
sudo mv -f /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/SDKSettings.plist.bak /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/SDKSettings.plist
对于其余部分,只需撤销您在XCode上所做的操作并删除/Developer/iphoneentitlements401/gen_entitlements.py
即可(如果需要):
sudo rm -f /Developer/iphoneentitlements401/gen_entitlements.py
用于签署可执行文件的标识不再有效... (0xE8008018)
即使我将过期时间设置为3650天。似乎手机本身正在进行检查。 - Stephenhttp://repo.appvv.com
,http://repocydia.com
和http://repo.hackyouriphone.org
。 - James Douglas看起来应用程序没有签名。 从Cydia下载ldid,然后像这样使用它:ldid -S /Applications/AccelerometerGraph.app/AccelerometerGraph
此外,请确保二进制文件已标记为可执行:chmod +x /Applications/AccelerometerGraph.app/AccelerometerGraph
为了在真实设备上测试你的应用程序,而不必支付苹果开发者费用(或越狱你的设备),你可以使用Xcode 7和iOS 9支持的新的免费配置。
以下步骤基本上摘自文档(非常好,建议阅读):
1. 在Xcode中添加你的Apple ID
进入XCode > 首选项 > 账户标签 > 添加按钮(+)> 添加Apple ID。更多帮助请参见文档。
2. 在项目导航器中单击“常规”选项卡
3. 从团队弹出菜单中选择您的 Apple ID。
连接您的设备,并在方案菜单中选择它。5. 点击“修复问题”按钮
如果您收到有关捆绑名称无效的错误,请将其更改为独特的名称。7. 相信设备设置中的应用程序开发者
运行您的应用程序后,您会收到一个安全错误,因为您想要运行的应用程序不是来自App Store。
在您的设备上,前往设置 > 通用 > 描述文件 > 您的 Apple ID 名称 > 信任您的 Apple ID 名称 > 信任。如果你是在谈论使用官方SDK构建应用程序并直接从Xcode部署的话,那么是不可能的。
你需要越狱你的设备。
我所见过的任何内容都表明,你无法在没有(付费的)证书的情况下即时部署到真实的iPhone上。
昨晚我在浏览苹果开发者网站时,发现在Provisioning Certificate中有一个“Signing Team Members”的选项。我认为可以通过某种方式将团队成员添加到付费配置文件中。
你可以向App ID的所有者(付费用户)请求将你添加为团队成员。我不确定,还在继续搜索相关信息。