Xcode releases an app to the debugging Machine

Source: Internet
Author: User

Xcode releases an app to the debugging Machine


Today, we will introduce how to use xcode to release our developed app to our own machine (how to release it to app store is not covered in this article ). We will use xcode to write a small test program, which will be tested on the simulator and the real machine respectively. Note that before testing on a real machine, you must first purchase an apple IOS developer certificate (99 knives ). Specific purchase process can refer to here: http://blog.csdn.net/htttw/article/details/7939405

Take iPod as an example.



1.

First, create a local key. However, you need to set key chain access first.Open preferences of applications/utilities/key chain access and disable both OCSP and CRL in certificates, As shown below:





2.

Then open key chain access:




Select certificate Assistant/request a certificate from a certificate authority from the keychain access menu..., As shown below:




3.

Enter your email and name, select Save to disk, select let me specify key pair information, and click Continue:





4.

Keep the key size and algorithm as default values. Click "continue" and select the storage location. At this point, our local key has been generated. It is a file ending with. certsigningrequest:





5.

Next we will upload this key file to the Apple Server:

Log on to pai.apple.com and have an "iOS provisioning Portal" on the right ":




Click in, as shown below:




Select certificates in the left sidebar, and click request certificate to apply for a certificate., As shown below:


Then click choose file, select the locally created key file, and click submit:






6.

After refreshing this page, a new certificate will be generated in the original blank development certificates:



Note that the pending issuance is displayed in the status on the right, because we have not downloaded the WWDR,Click "Click here to download now.After the download is complete, double-click the file and click Add to start installation:





After adding, refresh the previous page again. Now the download link appears:



Download this file. It is a. Cer file.




7.

Double-click the downloaded. Cer file and click Add to start installation:





Now we want to add a device:


8.

Open xcode and connect the iPod to your computer. The organizer window is displayed automatically in xcode. if the version matches, the following information is displayed:




The identifier of the replication device (40-bit hexadecimal number ).




9.

Return to the previous IDP provisioning portal page and select the third devices in the left sidebar:




Click Add devices, as shown below:




Enter the device name and device ID (the former can be customized by the developer, and the latter is the identifier of the device previously obtained in xcode), and then click Submit




10.

After the device registration is complete, return to the previous IDP provisioning portal page and select the fourth app IDs in the left sidebar (generally, an app ID corresponds to an application ):




Click the new app ID, as shown below:




When filling in the app ID, the description part can be filled by the developer at will, but it can only be a letter or number (no space); while the "bundle identifier" is very important, if this information is incorrect, the real machine test application cannot be completed. There are two specific methods. Let's take a look at a Use Case "com. domainname. appname" provided by Apple ". The naming rules must be followed. The first ". "com" must be filled in according to the style provided by Apple, while "domainname" must be customized by users. This part of information can be filled in by developers at will, but apple recommends the company's domain name. The last part indicates the name of the application to be tested. For example, if an application called app is created using xcode, enter the app. Of course, you can also use the "*" number to represent the app
ID can be used in any COM. domainname. * program. The second type is recommended in this article.
As shown in:


Click Submit.




11.

After the app ID is created, return to the previous IDP provisioning portal page and select provisioning in the fifth column on the left (this provisioning will tell xcode whether to allow the application to be downloaded to the real machine ):



Since we have not created provisioning before, it is empty.



Click new profile. The profile name can be any letter or number, select the certificates you created earlier, and select the ID of the previously created app from the drop-down list, select the created devices and click submit:



Wait a moment, refresh the page, and a new profile file will appear. Click Download to download the profile file, which is a. mobileprovision file:



12.

Open xcode and double-click the. mobileprovision file you just downloaded. The following results are displayed in the xcode organizer window, indicating that the profile we generated previously is legal:





Now, the connection between our debugging machine and xcode is complete.




Next we will use xcode to create a test program and run it on our iPod:


13.

We create a single view application named test:







14.

Add a button on the home page. Click it and an alert window will pop up. The Code is as follows:

-(Ibaction) btnalert :( ID) sender {nsstring * STR = @ "you pressed the press button"; uialertview * alterview = [[uialertview alloc] initwithtitle: @ "message: STR delegate: Nil cancelbuttontitle: Nil otherbuttontitles: @ "OK", nil]; [alterview show]; [alterview release];}

The interface file is as follows:






15.

Connect the button with btnalert. NotesThe code in step 1 is incorrect in xcode and the prompt "release is unavailable..." is displayed ....":



The solution is as follows:

Click the top-level project directory on the Left bar, select test in the targets column in the middle bar, and set the objective-C automatic IC reference counting on the Right To no (you can search in the upper right corner ):





16.

In the upper left corner of xcode, select iPhone 5.1 simulator (IPAD 5.1 simulator by default ):




Click the triangle button on the left to run. The following dialog box may pop up:




As long as you enter the following command on the terminal, the dialog box will no longer pop up:

sudo /usr/sbin/DevToolsSecurity --enable


17.

The result in the simulator is as follows:

Click the button to bring up the alert dialog box:







18.

The following is the most exciting time. We want to download it to our iPod host and run it:

First, set the bundle identifier in the Test-Info.plist for the bundle identifier you created in step 1, must be consistent, otherwise the real machine cannot run!




In the Project Settings, select code signing identity (You can also search in the upper left corner) and change it to "iPhone developer ":






19.

Then select your real machine device in the upper left corner of xcode, as shown below:




Click the triangle button on the left to start downloading to the real machine:

However, the following dialog box may pop up:


You can choose always allow once and for all.



Real machine running result:

Initial interface:




Press the press button:




At the same time, test has been installed on our real machine:




Now, the complete process from applying for a certificate to downloading it to running a real machine is complete. You can also try it ~~



For more information, see:

Http://blog.sina.com.cn/s/blog_68e753f70100r3w5.html

And

Http://iphone.tgbus.com/dev/iosdev/201205/20120516171253.shtml


The written information is very detailed.






Done!

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.