XCode6.0 iOS Certificate-free real machine test method (both MAC and black apple are valid)

Source: Internet
Author: User
Tags file info key string

XCode6.0 iOS Certificate-free real machine test method (both MAC and black apple are valid)

Currently, iOS programs developed on XCode can only run in Simulator. If you want to test on a real machine, you need an officially authenticated developer account of Apple to buy the developer certificate iDP for $99 a year!

As a newbie who just started learning iOS programming, it's really a pain to spend so much money... After some tossing and learning from the posts of various great gods, we finally succeeded in compiling and running on the real machine!

Here we will share the methods with you.

My running environment is: computer] XCode6.0.1 + OS X 10.9.5 real iPod Touch] iOS6.1

Preparations:

1. First, you need an iPhone/iPod/iPad that has been jailbroken. The jailbreak method is not provided here.

2. Add Source: http://apt.weiphone.com in the true machine Cydia for testing, download AppSync suitable for the real machine system version.

3. Create a certificate on your computer to sign the generated program.

Create Certificate

The process of creating a certificate is relatively simple. Open "others-key string access" on your computer ". Click "key string access-certificate assistant-create certificate..." in the menu bar ..." To open the wizard. Note that the name must be named as iPhone Developer, 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.

4. If Xcode is in running state, close Command + Q first. Open "Other-terminal" and we need to use some UNIX commands, which may seem complicated, but believe me, this saves US $99 a year!

① Go to the iPhone SDK directory and run the following commands:

 
 
  1. cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/ 

Note: The final version of Xcode of different versions is different. In Xcode 6.0, It is the iPhoneOS8.0.sdk. The version may be higher in the future, and the earlier version will be lower. Modify the settings as needed. If you do not know your version number, you can use the "ls" command to view all files .)

② Back up the original file. If the computer has a password, the system will prompt you to enter the password and it will not be displayed. Press enter)

 
 
  1. sudo cp SDKSettings.plist SDKSettings.plist.orig 

③ Edit the configuration file SDKSettings. plist

To facilitate the modification, we can directly open the file using Xcode. First, open the directory where the file is located:

 
 
  1. open . 

In the pop-up Finder window, double-click SDKSettings. plist to start the Xcode graphical interface, expand DefaultProperties, and change the following ENTITLEMENTS_REQUIRED and CODE_SIGNING_REQUIRED attributes to NO.

Note: The system prompts "SDKSettings. plist" is locked for editing ......], This is because of the file read and write permissions. The solution is as follows:

First, modify the folder permission. In this case, the directory is iPhoneOS8.0.sdk. If you enter the command "cd .. "Back to the parent directory," ls-al "to view all the files. The system displays iPhoneOS8.0.sdk-> iPhoneOS. sdk. sdk shortcut, so the real folder we want to modify is iPhoneOS. the command is as follows:

 
 
  1. sudo chmod -R 777 iPhoneOS.sdk 

Then, modify the read and write permissions of all files in the folder:

Sudo chmod 777 *

Double-click to open SDKSettings. plist. You will find that attributes that cannot be modified can be modified!

④ Edit another configuration file Info. plist

 
 
  1. cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform 
  2. sudo cp Info.plist Info.plist.orig 
  3. open . 

Double-click Info. plist in the pop-up Finder window. Under the DefaultProperties branch, RuntimeRequirements branch, and OverrideProperties branch, all XCiPhoneOSCodeSignContext is changed to XCCodeSignContext.

Note: As in step 3, you may encounter permission issues. modify the permissions of the Platforms folder and all files in the folder. The steps are the same as above.

5. Prepare a custom script after generation. This step must be performed on the Internet)

 
 
  1. sudo mkdir /Applications/Xcode.app/Contents/Developer/iphoneentitlements 
  2. cd /Applications/Xcode.app/Contents/Developer/iphoneentitlements 
  3. sudo curl -O http://www.alexwhittemore.com/iphone/gen_entitlements.txt 
  4. sudo mv gen_entitlements.txt gen_entitlements.py 
  5. sudo chmod 777 gen_entitlements.py 

6. Modify Project Settings

Note: you only need to modify the configuration file and prepare the script once before this phase. However, this phase of operation is required for every project that requires real machine debugging.

① Disable Xcode's Automatic Signature operation

Set all the Code Signing options in Build Settings for the project to Don't Code Sign ,.

② Add a custom generated Script in Build Phases, click "+" in the upper left corner, add a "New Run Script Phase", and enter the following Script:

 
 
  1. export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate 
  2. if [ "${PLATFORM_NAME}" == "iphoneos" ] || [ "${PLATFORM_NAME}" == "ipados" ]; then 
  3. /Applications/Xcode.app/Contents/Developer/iphoneentitlements/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 

Via: LiuLiu's notebook

Now all configurations are complete !!! Connect your iPhone/iPod/iPad, compile and run the program, and save $99 when you see the program running on the real machine screen !!!

I would like to thank the great god post for providing Xcode 5 + iOS 7 Certificate-free (iDP) Real-machine debugging and IPA generation.

Related Article

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.