original articles, welcome to share, without permission, not reproduced;All rights reserved, infringement must be tracedThe development environment uses the latest stable software so far: Mac OS X Lion 10.7 + Xcode 4.1 The current Xcode 4.2 preview version has also been released, it is said that the modification method is similar to 4.1, only changed one line of code, please refer to the second article of the reference article. This article still takes version 4.1 as an example. Update: Now that the Xcode 4.2 version and iOS 5 have been released, the following additions are made to the 4.2 modification methods. (2011-10-24) Each step will indicate the version, for example (Xcode4.1) and(Xcode4.2), the 4.2.1 method is exactly the same as 4.2Steps that are not indicated for the two versions are required! Update: Now that Xcode 4.3 has been published, the modified method is similar, and the modification steps of Xcode 4.3 will be(Xcode4.3 please execute) mark (2012-2-7)Update: Now the perfect jailbreak for Xcode 4.3.2 and iOS 5.1.1 has been released, this article has been updated in a timely manner. Similar to the modification method, the modification steps of Xcode 4.3.2 will be(Xcode4.3.2 please execute) mark (2012-5-28)Update: Mountain Lion + Xcode 4.4 has been released, I have not installed, but in the comments see already have friends tested successfully, here congratulate these friends! (August 5, 2012)Update: Xcode 4.5 for Mountain Lion has been released. I have updated and pro-test cracked successfully. Xcode 4.5 The original XML format plist file into a binary format, so the modification method slightly different, the specific operation has been given in the text, please friends test! (Updated October 2, 2012)
February 7, 2012 update:currently I have tested and confirmed that the effective platform hasXcode 4.1:IPod Touch 4 IOS 4.3.3
Xcode 4.2:IPod Touch 4 IOS 4.3.3IPod Touch 4 IOS 5.0IPod Touch 4 IOS 5.0.1
Xcode 4.2.1:IPod Touch 4 IOS 4.3.3IPod Touch 4 IOS 5.0.1iPhone 4S IOS 5.0.1 (5a406)
Xcode 4.3 (updated February 7, 2012)iPhone 4S IOS 5.0.1 (5a406)
Xcode 4.3.2 (Updated May 28, 2012)iPhone 4S IOS 5.1.1
Xcode 4.4.1 for Mountain Lion (updated September 26, 2012)iPhone 4S IOS 5.1.1
Xcode 4.5 for Mountain Lion (updated October 2, 2012)iPhone 4S IOS 5.1.1
Xcode 4.6 for Mountain Lion (updated February 12, 2013)iPhone 4S IOS 6.1
In addition, the operating system version seems to have little impact on debugging, the use of the system has Mac OS X 10.6~10.8.2, there is no problem.
Of course, you need to jailbreak your device and install it through Cydia appsync This article refers to a number of articles, combining the methods, and correcting the errors, organized. Do not reprint without permission. This article was first published in the http://kqwd.blog.163.com/reference articles are: Http://laolang.cn/back-end-develop/helloworld-iphone-developer.htmlhttp ://ccmos.tw/blog/2011/06/30/xcode4-port-program-to-idevice-without-idp/http://www.cnblogs.com/flyingzl/articles/2207717.html
It is well known that the program developed on Xcode can only run in the emulator, and it costs $99 to purchase the developer Certificate IDP if it is to be placed on the real machine. This is a serious impediment to my grassroots developers to explore the footsteps. Write a small program, the students share this little wish is not satisfied, nature can not rest. In the absence of the IDP, to put the program on the iphone to debug, and eventually publish the IPA for sharing, The following steps are required: 1. Self-issued a certificate used to sign the generated program 2. Modify the project configuration and Xcode configuration files and binaries to prevent their validation and signature 3. Sign the application with a forged certificate using a custom build step 4. Use a small trick to generate an IPA file
1. The process of creating a certificate creates a simple, open utility-keychain access. Then click Keychain Access-Certificate assistant-Create a certificate in the menu bar to open the wizard. The first step is more important,you must name the iphone Developer, set the type to code signing, and select Let me override these defaults. The following steps do not need to be changed, just click "OK" and "continue" to complete the wizard.
2. Modify the Xcode configuration file and binary files The following steps are a little cumbersome, you should understand the basic operation of the Unix command line, and understand a command text editor, this article uses VIM. Although the complete code is given here, the basic operation of modifying and saving the code is not to be mentioned. The following actions should beturn Xcode off completely by pressing COMMAND+Q。 (1) Modify the configuration file to enter the directory and back up the original file(4.1, 4.2, 4.3 Here The main difference is the directory name of the SDK is different) (Xcode4.1 please do)cd/developer/platforms/iphoneos.platform/developer/sdks/iphoneos4.3.sdk/(Xcode4.2 please do)cd/developer/platforms/iphoneos.platform/developer/sdks/iphoneos5.0.sdk/(Xcode4.3 please do)CD/APPLICATIONS/XCODE.APP/CONTENTS/DEVELOPER/PLATFORMS/IPHONEOS.PLATFORM/DEVELOPER/SDKS/IPHONEOS5.0.SDK (Xcode4.3.2 please do)CD/APPLICATIONS/XCODE.APP/CONTENTS/DEVELOPER/PLATFORMS/IPHONEOS.PLATFORM/DEVELOPER/SDKS/IPHONEOS5.1.SDK (Xcode4.5 please do) CD /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/ IPHONEOS6.0.SDK(Xcode4.6 please do) CD /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/ IPHONEOS6.1.SDK
sudo cp sdksettings.plist SDKSettings.plist.origFor editing(for versions other than Xcode 4.5, including Xcode 4.6)sudo vim sdksettings.plistChange Yes to no<key>code_signing_required</key><string> in the following two paragraphsYES</string> and <key>ENTITLEMENTS_REQUIRED</key><string>YES</string>
the plist format of Xcode 4.5 is not XML, but instead it is Apple's own binary format, and we use Xcode itself to edit the plist file, which is the commandSudo/applications/xcode.app/contents/macos/xcode./sdksettings.plistwill start Xcode's graphical interface, we will expand the defaultproperties Branch, the following code_signing_required and entitlements_ REQUIRED Two properties change to NO
Modify another file below to enter the directory and back up the original file(xcode4.1/4.2 please do)cd/developer/platforms/iphoneos.platform/(xcode4.3/4.4/4.5/4.6 please do)Cd/applications/xcode.app/contents/developer/platforms/iphoneos.platform
Backupsudo cp info.plist Info.plist.orig
Edit File(xcode4.1/4.2/4.3/4.4 please do)sudo vim info.plistWill all theXciphoneoscodesigncontextModified intoXccodesigncontext, most of the articles on the internet say there are 2, but I found 3, perhaps Xcode 4.1 to one more place?(Xcode 4.2/4.3/4.3.2 also has three places)Anyway, it's all over. Tip: To search for content entered/To be searched in Vim, press N to search the next place.
(Xcode 4.5/4.6)The edit command is as followssudo/applications/xcode.app/contents/macos/xcode/applications/xcode.app/contents/developer/platforms/ Iphoneos.platform/info.plistXcode 4.5 and 4.6 also have three locations, under the Defaultproperties branch, under the Runtimerequirements branch, and under the Overrideproperties branch.
(2) Binary patch # Create script on desktopCD ~/desktopVim Script#(Xcode 4.1 execution)Enter the following in the editor#!/bin/bashcd/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=255printf "xc3x26x00x00" >> working/bin/mv-n iphoneos\ build\ system\ support iphoneos\ build\ system\ support.original/bin/mv working iphoneos\ build\ system\ Supportchmod a+x iphoneos\ build\ system\ Support#(Xcode 4.2 execution)Enter the following in the editor#!/bin/bashcd/developer/platforms/iphoneos.platform/developer/library/xcode/privateplugins/iphoneos\ Build\ System\ support.xcplugin/contents/macos/DD if=iphoneos\ build\ system\ support of=working bs=500 count=255printf "xc3x26x00x00" >> working/bin/mv-n iphoneos\ build\ system\ support iphoneos\ build\ system\ support.original/bin/mv working iphoneos\ build\ system\ Supportchmod a+x iphoneos\ build\ system\ SupportSave and exit. (The difference between 4.1 and 4.2 is also a different directory name, which is the green part of the code.) 4.1 is Plug-ins and 4.2 isPrivatepluginsGrant this script permission to execute and execute itchmod 777 Script./scriptNormal words should be output (the exact number may be different)231+1 Records in231+1 Records out115904 bytes Transferred in 0.001738 secs (66694555 bytes/sec)#(Xcode 4.3 note) in the Xcode 4.3 version, I did not findIphoneos Build System support.xcpluginThis plugin, so I skipped this step, and I finally managed to debug it online. So I personally think that xcode 4.3 does not need to implement the "binary patches" step. Please friends Test ~! #(Xcode 4.3.2/4.4/4.5/4.6 Note) in the Xcode 4.3.2 release, we can findIphoneos Build System Support.xcplugin, but I did not modify it, still can be online debugging. This modification step is inherited from Xcode 3.X, and we have reason to guess that in the Xcode 4.x version, there is no need to modify this file. (Updated May 28, 2012)
At this point, the changes to the configuration files and binaries in the SDK are complete
3. Prepare custom post-build scripts to connect after Internet execution# (Xcode 4.1/4.2 execution)mkdir/developer/iphoneentitlements401cd/developer/iphoneentitlements401Curl-o http://www.alexwhittemore.com/iphone/gen_entitlements.txtMV Gen_entitlements.txt gen_entitlements.pychmod 777 gen_entitlements.py
# (Xcode 4.3/4.4/4.5/4.6 execution)mkdir/applications/xcode.app/contents/developer/iphoneentitlementsCD/applications/xcode.app/contents/developer/iphoneentitlementsCurl-o http://www.alexwhittemore.com/iphone/gen_entitlements.txtMV Gen_entitlements.txt gen_entitlements.pychmod 777 gen_entitlements.py
enthusiastic Netizen ringo_d points out that there may be a problem with permissions. I did not seem to have a problem when you execute this code, if you encounter permission denied hint, please add the corresponding statement in front of Sudo to get super permissions. (Updated June 15, 2012)
If you are already connected, go directly to step 4, if you do not have a network, manually create the gen_entitlements.py in the appropriate directory and give it permission to execute, the content of this file is #!/usr/bin/env python
Import Sysimport 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 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> <k ey>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 ()
4. Modify Project SettingsSpecial 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" to show this option (2) Add a custom post-build script to add a Phase in build phases, the add build Phase in the lower-right corner, and then click Add Run Script to enter the following script(for Xcode 4.1/4.2)Export Codesign_allocate=/developer/platforms/iphoneos.platform/developer/usr/bin/codesign_allocateif ["${platform_name}" = = "Iphoneos"] | | ["${platform_name}" = = "Ipados"]; 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(for Xcode 4.3/4.4/4.5/4.6)Export codesign_allocate=/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/ Usr/bin/codesign_allocateif ["${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
: This configuration is complete, the following can plug in the iphone, re-select the target to test the online debugging! If this is the first time to use the device debugging, please first switch the device to development mode in organizer, see FAQ 5 for more details.
5. heterodoxy Generate IPA file if my program is well debugged, how can I send it to someone else? 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 use a small trick to complete this operation. The code is first born as a release target, and then the output folder of the project is opened, typically this directory is/users/Your user name/library/developer/xcode/deriveddata/a folder that starts with the project name/build/products/release-iphoneosVery tangled Bar ~ this directory has a. app file, which is the generated program. Drag this. App into itunes, it will appear in the app's list, and then drag it out of the itunes list (like drag to the desktop), what happened? Haha, it just became. IPA! Send this. IPA to a friend so that everyone can share this program with you.
Since the article has been published more than 5,000 hits, but also received a lot of enthusiastic bo friends feedback and questions. are now sorted out and listed as frequently asked questions. Thank you for your attention! (December 2, 2011)FAQ:not successful first look here!! This article hits more than 6000, countless friends to test success, if you fail the basic can be determined that you do not strictly in accordance with the method of the article operation, the following list of common problems, look forward to your friends before you ask questions to see!! (December 14, 2011)
1. I am a beginner, what is the authority? What does the Execute permission (x permission) mean? What is a script? How do I add Execute permissions? What is sudo command? What is vim and how do I save changes in vim? What do you mean I can't find the catalogue? I have some steps did not understand, can add QQ communication? Answer: First of all thank you for your interest in my blog. Here to remind beginners friends, Xcode provides a very perfect simulator debugging environment, simulator debugging is much more convenient than the real machine debugging, also much simpler, using the simulator debugging program is the normal development of iOS. Real-Time debugging is usually done when the product is almost finished, see the program on the actual machine visual effects and so on. There are also programs that rely on accelerometers to test the accelerometer's program for any problems. Therefore, beginners do not need to start the real-machine debugging. The primary purpose of a beginner's real-computer commissioning may not be to learn technology, but to satisfy curiosity, pursue fulfillment, and even show off to friends. These goals are not worth the effort to read this article. so this article is to have a certain basis of friends to see, all kinds of commands are unavoidable. Basic commands in Unix such as Cp,mv,cd,chmod,sudo and Vim editor, if you have not heard of it, we strongly recommend that you do not try the changes mentioned in this article. Once you've changed the wrong light, Xcode hangs up and the system crashes. If you encounter a problem that can not be solved welcome message inquiry, must give detailed error information, otherwise cannot judge. bloggers do not answer questions like how to execute script code, how to give execute permissions, how to use the Vim editor (how to save), and other Unix-based issues unrelated to iOS development. Bloggers are very happy to form, to meet ideas, creative, skilled Daniel. Bloggers will also not regularly to the blog on the enthusiastic users of the questions asked for a simple answer. But there is not enough time through the QQ on the steps of the hands-on interpretation and guidance. Here first to the friends who have this need to say sorry!
2. Various errors, the error message contains "No such file or directory" sentenceAnswer: The meaning of the error message is very clear, that is, "there is no such file or directory." This type of error is usually caused by an incomplete copy of your code or an installation error in your development environment. Please check again the error directory is present, check the code and this article is the strict consistency, a variety of check bar ~ is a low-level error
3. When debugging online, the program can not be installed to the device, or the error message contains "code signing", "CERT", "signature" or "certificate" (the most common error!!). )Answer: Certificate error or signature error, this problem should not ask, it must be because you do not strictly the steps of the article. Remind you to check where there are (1) there is no set to don ' t code signing (2) after the post-build event codes have been pasted correctly (3) whether the Python script has been successfully executed (4) whether the device has been jailbroken and installed Appsync (5) The first step of the iphone Whether the developer certificate was created correctlyThe most likely problem is that the post-build event code (the run Script in the article) is not executed correctly. It may be that you forgot to add the run script and pasted that code, or you didn't copy it all, or you copied it to a special character causing an error to occur. The way to see the execution results of that script is in the sidebar on the left side of Xcode, click on one of the most right tags (Show the log navigator), look at a recent build log (not the debug log), find a row of the run custom shell Script "Run script" that line, normally the line is the same as the other lines, is not expandable. If there is a small arrow on the left side of the line, then you can expand it by clicking it, and then the information that is executed is wrong. Please carefully review the error message and fix the error in the script. If the build log doesn't haveRun custom shell script "Run script", that means you forgot to add the build script ... (Updated February 9, 2012)add: One of the frequently reported errors in Run script is "replacing existing signature"..... This hint means "replace an existing signature" and the reason for this is that you did not successfully prevent Xcode from signing the application using the default method. Because the rationale behind this hack is to prevent Xcode from signing the app, use the custom procedure in script to manually sign the app. When script signs the app, it finds that the app has been signed by Xcode and will report the error. After this error, remind you to check the place there are two (1) sdksettings.plist in the need to modify the place has been correctly modified (2) The project settings will be the 5 signature options are all set to "T Code signing (June 15, 2012 update)
4. Can I use the ipad? answer: I don't have an ipad, so I can't answer it accurately. But from the enthusiastic blogger's reply, the ipad is undoubtedly available. If you need to use the ipad fourth step in the script file Platform_name = = iphones replaced by Platform_name = = ipads will be error ~ (thank Bo Friends Xyishao suggestions) thank qingcheng89 for the improvements, now look at the above code can directly support the ipad without modification, please friends to test. (Updated February 9, 2012)
5. Why is my build for archiving option grayed out? Answer: It is because you did not plug the device into the computer. Although this question is very stupid, but I have also had this question, haha ~ ~after the enthusiastic Netizen xc7296815 reminds, the device does not turn on the development mode also causes the build for archiving not to be available. The way to open the development mode is: Plug in the device, click on the Organizer icon in the upper right corner of Xcode, check your device, and see what color the small light is on the left side of the device name. If the gray indicates that the development mode is not turned on. At this point, in the right window, clickUse for development"can. If yellow please re-plug the device, if the green represents the device has been opened development mode (December 25, 2011)Supplement to enable development mode: When you click on Use for development, you will be asked to enter your Apple ID, click Cancel here. The process that enabled device development mode terminates immediately. There should be a yellow light next to the device name. At this time to reseat the device, the organizer will appear a progress bar, and so the progress bar ran, the small lights will turn green, the development mode has been enabled. (Updated May 28, 2012) More recently, it has often been questioned that the lights in the organizer are always yellow, no matter what. This situation is almost entirely certain that your Xcode version is not high enough. If your device is iOS 5.1.1, you must use Xcode 4.3.2 or later. Similarly, the IOS 5.0.1 corresponds to Xcode 4.3.1,ios 5.0 for Xcode 4.3 ... (Updated on 2012 6 and 5th)
6. My iOS version/xcode version is different from yours, can I use it? answer: I have tested the environment and equipment has been given at the beginning of the article. Other environment I have not tested, there is no condition test, so when your environment is different from mine, do not ask me is not available, you can try, and then tell me the results, but also for other users to provide convenience, in the first thank you!
7. Real machine debugging occursError launching remote program:failed to get the task for process XXX error (updated January 26, 2012)Answer: I did not seem to have encountered this problem in the debugging, but many netizens pointed out that there will be this problem, who will tell me what circumstances would be out of this problem? If you are experiencing this problem, please read the official Apple help document http://developer.apple.com/library/ios/#qa/qa1710/_index.html February 1, 2012 update: A netizen indicates that the error was caused by a permission set error. Because I use the same user with the error of the same environment, and in the course of the operation did not encounter this error, so the basic can be determined that you did not follow the steps, please check the whole process again, especially the enthusiastic netizen proposed download script and modify the implementation of the section of the permissions. after I test, if this error occurs after the compilation is run, and the phenomenon is the program flash on the device, it is due to the signature error, this is because you did not follow the above steps to do so, please refer to FAQ 3. (Updated February 9, 2012)
The article is so long ... Welcome to the master of the road.
"Reprint" Xcode 4.1~4.6 + ios 5, iOS 6 certificate free (IDP) development + Real Machine Debug + Generate IPA all Raiders