XCode4.2 (4.1) real machine debugging and IPA generation

Source: Internet
Author: User
Tags key string
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:

 
 
  1. CODE_SIGNING_REQUIREDkey>
  2. NOstring>
  3. ENTITLEMENTS_REQUIREDkey>
  4. NOstring>

3. Crack the xcode binary file. Create a crack file with the following content:

 
 
  1. #!/bin/bash
  2. cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/PrivatePlugIns/iPhoneOS\ Build\ System\ Support.xcplugin/Contents/MacOS/
  3. dd if=iPhoneOS\ Build\ System\ Support of=working bs=500 count=255
  4. printf "xc3x26x00x00" >> working
  5. /bin/mv -n iPhoneOS\ Build\ System\ Support iPhoneOS\ Build\ System\ Support.original
  6. /bin/mv -n working iPhoneOS\ Build\ System\ Support
  7. 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:

 
 
  1. cd /Developer
  2. mkdir xcode-crack
  3. curl -O http://www.alexwhittemore.com/iphone/gen_entitlements.txt
  4. mv gen_entitlements.txt gen_entitlements.py
  5. 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 ()

 
 
  1. export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
  2. if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
  3. /Developer/xcode-crack/gen_entitlements.py "my.company.${PROJECT_NAME}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent";
  4. codesign -f -s "iPhone Developer" --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
  5. 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

 
 
  1. export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
  2. if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
  3. /Developer/iphoneentitlements401/gen_entitlements.py "my.company.${PROJECT_NAME}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent";
  4. codesign -f -s "iPhone Developer" --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
  5. fi

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.