XCode4.2 (4.1) real machine debugging and IPA generation many articles on xocde3.x real machine debugging are available on the Internet, but there are few documents related to xcode4.2. After reading some articles, you can finally debug the real machine on xcode4.2, which is recorded here. As we all know, programs developed on Xcode can only run in simulators.
XCode 4.2 (4.1) real machine debugging and IPA generation many articles on xocde3.x real machine debugging are available on the Internet, but there are few articles related to xcode 4.2. After reading some articles, you can finally debug the real machine on xcode4.2, which is recorded here. As we all know, programs developed on Xcode can only run in simulators.
XCode 4.2 (4.1) real machine debugging and IPA generation
There are many articles on xocde3.x real machine debugging on the Internet, but there is little xcode4.2 related information. After reading some articles, you can finally debug the real machine on xcode4.2, which is recorded here.
As we all know, programs developed on Xcode can only run in simulators. If you want to put them on a real machine, you will spend $99 to buy the developer certificate iDP. This severely hinders the development of grassroots developers. When I write a small program, I can't satisfy all my wishes. Naturally, I cannot give up.
In the absence of iDP, the following steps are required to put the program on the iPhone for debugging and finally release IPA for sharing:
1. issue a certificate for yourself to sign the generated program
2. Modify the project configuration and Xcode configuration files and binary files to prevent them from verifying and using the forged certificate.
3. Use custom steps to sign the application
4. Use a little trick to generate the IPA File
1. Create a certificate
I will explain it in several steps. It is worth noting that to debug a real machine, ios device must be jailbroken in advance. The process of creating a certificate is relatively simple. Open the utility-key string access. In the menu bar, click Key string access-certificate assistant-create certificate to open the wizard. The first step is important. You must name it iPhoneDeveloper, set the type to code signature, and select "let me overwrite these default values. The subsequent steps do not need to be changed. Click "OK" and "continue" to complete the wizard.
1. Create a certificate. There is nothing to say about it. There is a lot of information on the Internet, as long as you do not write the wrong name, the certificate name must be iPhone Developer
2. Crack the configuration files of ios sdk and xcode (double-click the configuration file to open it. Note that SDKSettings. plist has permission Control)
Modify the Info. plist file in the/Developer/Platforms/iPhoneOS. platform directory and change the XCiPhoneOSCodeSignContext to XCCodeSignContext.
Modify the SDKSettings. plist file in the/Developer/Platforms/iPhoneOS. platform/Developer/SDKs/iPhoneOS5.0.sdk directory and modify the following fields:
- CODE_SIGNING_REQUIREDkey>
- NOstring>
-
- ENTITLEMENTS_REQUIREDkey>
- NOstring>
3. Crack the xcode binary file. Create a crack file with the following content:
- #!/bin/bash
- cd /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=255
- printf "xc3x26x00x00" >> working
- /bin/mv -n iPhoneOS\ Build\ System\ Support iPhoneOS\ Build\ System\ Support.original
- /bin/mv -n working iPhoneOS\ Build\ System\ Support
- chmod a+x iPhoneOS\ Build\ System\ Support
Then execute chmod + x crack and execute./crack. If no error is found, it will work normally.
4. Modify the xcode project configuration file
1) download the script
Open the terminal and perform the following operations:
- cd /Developer
- mkdir xcode-crack
- curl -O http://www.alexwhittemore.com/iphone/gen_entitlements.txt
- mv gen_entitlements.txt gen_entitlements.py
- chmod 777 gen_entitlements.py
2) Disable Xcode's Automatic Signature operation
Set all the Code Signing options in the project configuration to Dont Code Sign ,. You may need to click "All" to display this option.
3) add custom generated scripts
Add a Phase in Build Phases, Add Build Phase in the lower right corner, click AddRun Script, and enter the following Script ()
- export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
- if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
- /Developer/xcode-crack/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
5. Package the application and generate the ipa File
Select the product menu in xcode and select Build For ---> Build for Achiving to become the ipa file.
You can drag this file to itunes to generate an ipa file,
Now, we can develop and debug ios programs as we like, and share the packaged ipa files with others.
Follow the steps above to import the 3.x project and run it successfully. However, if you use XCode 4.2 to create a new project, an error is reported. You need to make the following changes:
1. Change the default value of [Objective-C Automatic Reference Counting] from [YES] to [NO ];
2. Enter the following code and note that there are no special characters
- 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