"Go" ios free real-machine debugging

Source: Internet
Author: User

We all know that the program developed on Xcode can only run in the emulator, and if you want to put the program on the real machine it will cost $99 to purchase the Apple Developer Certificate IDP. Now I will teach you the test on the jailbreak phone when you want to run your own authoring IPA file without a developer certificate, like a free real machine.

1. Open the utility - keychain Access . Then click Keychain Access-Certificate assistant-Create a certificate in the menu bar to open the wizard. The first step is important, you must name the iPhone Developer, set the type to code signing , and select Let me override these defaults . After the steps do not need to change, just click " OK " and " continue " To complete the wizard can!

2. Modify the Xcode configuration file

1. Please exit the Xcode completely and press Command+q to close.

2. Modify the configuration file: Follow the path to find sdksettings.plist and edit it:/applications/xcode.app/contents/developer/platforms/iphoneos.platform /developer/sdks/iphoneos6.1.sdk/sdksettings.plist change the key values in the following two paragraphs to no:code_signing_required and Entitlements_ Required if the text is locked without modification permissions, you can find the Sdksettings.plist file, click on the file---display the file---Open the lock in the lower right corner---Enter the password to unlock---Modify the share and permissions to read and write permissions, so you can modify.

3. Modify another file below:

Follow the path to find info.plist and edit it: applications/xcode.app/contents/developer/platforms/iphoneos.platform/ Info.plist all the xciphoneoscodesigncontext in the info.plist into Xccodesigncontext, respectively, under the Defaultproperties branch, Overrideproperties under the branches and runtimerequirements branches. You will also encounter the above permissions issue.

4. Add Files:

After connecting the Internet in the terminal execution:

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

chmod 777 gen_entitlements.py

If you do not have a network, you can create a iphoneentitlements folder under the/applications/xcode.app/contents/developer folder, and then manually create a gen_ under that folder entitlements.py file and grant it Execute permissions (command: sudo), the contents of this file are:

#!/usr/bin/env python

Import Sys

Import struct

If Len (sys.argv)! = 3:

Print "Usage:%s appnamedest_file.xcent"% sys.argv[0]

Sys.exit (-1)

APPNAME = sys.argv[1]

DEST = sys.argv[2]

If not Dest.endswith ('. xml ') and Notdest.endswith ('. Xcent '):

Print "Dest must is. 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 ()

3. Modify the project Settings

Special note: Before this stage, modify the configuration file, prepare the script, etc., only need to do once. But the operation of this stage, for each need to debug the real machine to do the work once.

The main role of this step is to support real-machine debugging, if you do not do this step, you can still run through the step 5来 generation IPA on the real machine, but you cannot use the Xcode built-in debugger to run on the real machine for single-step tracking. If your program is seconds off when you click Run real-Time debugging, check to see if this step is complete correctly.

1. Disable Xcode automatic signature operation

Set all the code signing options in the project configuration to don ' t code sign. You may need to click "All" first to make this option visible.

2. Add a custom post-build script

In build phases, add a Phase, the add Build Phase in the lower-right corner, and click Add Run script to enter the following 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

Note: Before Xcode5.0, figure one, followed by figure II

4, if my program debugging good, how can I send someone to use it? The IPA file is normally output from Xcode's organizer, but we do not have a certificate so the output generates an error.        We can only do this with a little trick. The code is first born as a release target, and then the output folder of the project is opened, typically this directory is the/users/user name/library/developer/xcode/deriveddata/a folder that starts with the project name/build/ Products/release-iphoneos This directory has a Xxx.app file, which is the generated program. Drag this xxx.app to itunes, it will appear in the app's list, and then drag it out of the itunes list (for example, to the desktop), it becomes XXX.IPA! Send this. IPA to others and you can share this program with you.

Transferred from: http://jingyan.baidu.com/album/1709ad80af62f84634c4f0bb.html?picindex=3

"Go" ios free real-machine debugging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.