Helloworld for iPad development and learning and publishing IPA

Source: Internet
Author: User
Tags key string

Zookeeper http://www.cnblogs.com/sss/archive/2010/08/27/ipaddevelop2.html

 

 

Compile helloworld

After completing the environment, open xcode to display the welcome page of xcode, as shown below:

Click Create a New xcode project, select iPhone OS-Application-view based application, and create a simplest blank iPadProgramHelloipad. Click build and run to enable the iPad simulator automatically.

The xocde file is as follows:

Find the helloipadviewcontroller. XIB file, double-click it, and start interface builder to edit the user interface. Click the rotation arrow in the upper-right corner to rotate to horizontal screen editing. Drag a tag, an edit box, and a button to edit the attribute and run the task, the horizontal and vertical screens are displayed as follows.

(Ignore the two dots on each interface. That is because the screenshot Shortcut Key of the VM conflicts with the test multi-point touch Shortcut Key of the simulator)

It is found that the display in the horizontal screen is very centered, but it is not automatically adapted and displayed in the middle after being erected. This is the need to set the automatic adaptation attribute, select one of the controls, select the page with a sliding block in the property on the right and click the line on the middle square to set the auto-adaptive property of the control. Apple is doing very well, place the cursor over this square, and the animation on the right will show the auto-adaptive animation you set, which is easy to understand. After setting the three controls, save the settings, or click build and run to prompt you to save the settings. Now let's see if it is centered.

At present, the screen is automatically adapted in four directions. What should I do if I only want to display the program in a specific direction? This requires encoding control. Return to xcode, double-click the helloipadviewcontroller. M file, and find the followingCode:

Comments return YES to the above Code to see if there are only two directions.

Let's talk about the direction definition of apple.

I am not good at English. I don't know how to translate this. The screen is landscape, left, and right, which indicates whether the Home Key is left or right. The portrait screen is called portrait. (I am also a beginner. I have read two chapters, so many of them do not understand it ).

Finally, I saw the code, which may be the favorite of programmers. Next, write a response event for clicking a button.

First, add the following content in the helloipadviewcontroller. h file (Red is the content to be added ):

# Import <uikit/uikit. h>

@ Interface helloworldviewcontroller: uiviewcontroller {

}

-(Ibaction) btnclicked :( ID) sender;

@ End

Add in helloipadviewcontroller. m

-(Ibaction) btnclicked :( ID) sender {

// --- Display an alert view ---

Uialertview * Alert = [[uialertview alloc] initwithtitle :@"Hello world!"

Message :@"IPad, here I come!"

Delegate: Self

Cancelbuttontitle :@"OK"

Otherbuttontitles: Nil];

[Alert show];

[Alert release];

}

In this way, the event handler has been written. The following is the event handler hanging to the Click Event of the button. Open interface builder, select the button, and hold down the control and drag it to helloworldviewcontroller. the file's owner in the XIB form will display a pop-up selection. Just select the btnclicked you just wrote. Compile and run it. click the button. A prompt is displayed. This is similar to the MessageBox of the vs series, the showmessage of the Delphi series, and the jsdialogs of the justep series. Haha

After the program is edited, we press the Home key on the simulator to find that the program icon is white. Next we will add an icon to the program.

Find a 72*72 PNG image, as I said in the book. I didn't find such a large image. It's okay to keep it small. Drag the image to the resources folder of xcode and select copy when prompted ). For example:

Double-click the HelloiPad-Info.plist file and edit the icon filevalue to the image name, which is apple.png. Click B & R to return to the home page, for example:

OK, everything is ready. I am in arrears. Select the compilation target as device and click build and archive. An error is reported as follows:

Why? Because you didn't buy a one-year certificate with 99 knives, you can only compile the certificate to the simulator, not to the device. 555555555555

Cracking jailbreak xcode

As mentioned above, the program cannot be compiled as a device. Here we will introduce a method for cracking. I am referring to the weiphone Forum (xcode 3.1.4 certificate cracking + iPhone 3G 3.1.2 real machine deployment (same for 3.2.1 )), first, open the program-utility-key string in MacOSX, select the certificate assistant, create a certificate for code editing, and then execute the following commands to copy the certificate from weiphone forum.

Certificate forgery:

Follow the steps in this tutorial to add a certificate. Note: The original tutorial selects a "system" certificate. Here we use the "login" certificate. Remember.

Xcode cracking

Close xcode, open your command line terminal, and copy and paste the following code:

#! /Bin/bash

CD/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 = 255

Printf "\ x8f \ x2a \ x00 \ x00"> working

Dd If = iphoneos \ build \ System \ support of = working BS = 1 skip = 127504 seek = 127504

/Bin/MV-N iphoneos \ build \ System \ support. Original

/Bin/mv working iphoneos \ build \ System \ support

Chmod A + x iphoneos \ build \ System \ support

Copy and paste the following code to the command line terminal after execution: (Internet connection is required)

Mkdir/developer/iphoneentitlements30

CD/developer/iphoneentitlements30

Curl-O http://www.alexwhittemore.com/iphone/gen_entitlements.txt

MV gen_entitlements.txt gen_entitlements.py

Chmod 777 gen_entitlements.py

After the script is executed, modify the "/developer/platforms/iphoneos. Platform/info. plist" file and make the following changes:

Add the following two items:

Provisioning_profile_allowed = No

Provisioning_profile_required = No

Use a text editor to open "/developer/platforms/iPhone OS. platform/info. in the plist file, replace all "xciphoneoscodesigncontext" with "xccodesigncontext" (very important. If you do not perform this step, xcode opens the project file and reports an error and exits.) Save and exit.

Open xcode, open your project, project> edit project setting, select the "build" Page, select all for deployments and show, locate the code signing identity item, and delete its subitem, assign "code signing identity" to "iPhone developer" (which is actually an option ).

Then find the xxx-Info.plist file for your project and add the "signeridentity" item with the value "Apple iPhone OS application signing". Save.

During this period, we will choose to sign the certificate. After clicking "allow", it is said that the certificate cannot be permanently clicked.

OK. Click build and archive again !!

Package IPA

The compiled program is the helloipad. app folder. We need to create an IPA installation package to facilitate installation on the iPad.

Step 1: Create a folder with any name. Find a jpg image of no more than 500*500 and rename it itunesartwork. Note that no suffix is available.

Step 2: Create a folder named payload and copy the compiled helloipad. app to this folder.

Third, modify the info.plistfile in the append. You can use pledit.exe to edit the file in windows and add the following content to the <dict> </dict> node:

<Key> signeridentity </key>

<String> Apple iPhone OS application signing </string>

Select payload and itunesartwork, right-click to produce the compressed zip file, for example, helloipad.zip, and change the suffix to IPA. Now you can double-click the helloipad. IPA file to see if you can add it to iTunes.

(Ignore the one on the side. The one with my son's portrait is just packed)

Real machine running

If you want to use iTunes to synchronize the IPA file or use other methods, you can just install the file on a real machine. The running interface is as follows:

Compile helloworld

After completing the environment, open xcode to display the welcome page of xcode, as shown below:

Click Create a New xcode project, select iPhone OS-Application-view based application, and create a simple iPad blank program helloipad. Click build and run to enable the iPad simulator automatically.

The xocde file is as follows:

Find the helloipadviewcontroller. XIB file, double-click it, and start interface builder to edit the user interface. Click the rotation arrow in the upper-right corner to rotate to horizontal screen editing. Drag a tag, an edit box, and a button to edit the attribute and run the task, the horizontal and vertical screens are displayed as follows.

(Ignore the two dots on each interface. That is because the screenshot Shortcut Key of the VM conflicts with the test multi-point touch Shortcut Key of the simulator)

It is found that the display in the horizontal screen is very centered, but it is not automatically adapted and displayed in the middle after being erected. This is the need to set the automatic adaptation attribute, select one of the controls, select the page with a sliding block in the property on the right and click the line on the middle square to set the auto-adaptive property of the control. Apple is doing very well, place the cursor over this square, and the animation on the right will show the auto-adaptive animation you set, which is easy to understand. After setting the three controls, save the settings, or click build and run to prompt you to save the settings. Now let's see if it is centered.

At present, the screen is automatically adapted in four directions. What should I do if I only want to display the program in a specific direction? This requires encoding control. Return to xcode, double-click the helloipadviewcontroller. M file, and find the following code:

Comments return YES to the above Code to see if there are only two directions.

Let's talk about the direction definition of apple.

I am not good at English. I don't know how to translate this. The screen is landscape, left, and right, which indicates whether the Home Key is left or right. The portrait screen is called portrait. (I am also a beginner. I have read two chapters, so many of them do not understand it ).

Finally, I saw the code, which may be the favorite of programmers. Next, write a response event for clicking a button.

First, add the following content in the helloipadviewcontroller. h file (Red is the content to be added ):

# Import <uikit/uikit. h>

@ Interface helloworldviewcontroller: uiviewcontroller {

}

-(Ibaction) btnclicked :( ID) sender;

@ End

Add in helloipadviewcontroller. m

-(Ibaction) btnclicked :( ID) sender {

// --- Display an alert view ---

Uialertview * Alert = [[uialertview alloc] initwithtitle :@"Hello world!"

Message :@"IPad, here I come!"

Delegate: Self

Cancelbuttontitle :@"OK"

Otherbuttontitles: Nil];

[Alert show];

[Alert release];

}

In this way, the event handler has been written. The following is the event handler hanging to the Click Event of the button. Open interface builder, select the button, and hold down the control and drag it to helloworldviewcontroller. the file's owner in the XIB form will display a pop-up selection. Just select the btnclicked you just wrote. Compile and run it. click the button. A prompt is displayed. This is similar to the MessageBox of the vs series, the showmessage of the Delphi series, and the jsdialogs of the justep series. Haha

After the program is edited, we press the Home key on the simulator to find that the program icon is white. Next we will add an icon to the program.

Find a 72*72 PNG image, as I said in the book. I didn't find such a large image. It's okay to keep it small. Drag the image to the resources folder of xcode and select copy when prompted ). For example:

Double-click the HelloiPad-Info.plist file and edit the icon filevalue to the image name, which is apple.png. Click B & R to return to the home page, for example:

OK, everything is ready. I am in arrears. Select the compilation target as device and click build and archive. An error is reported as follows:

Why? Because you didn't buy a one-year certificate with 99 knives, you can only compile the certificate to the simulator, not to the device. 555555555555

Cracking jailbreak xcode

As mentioned above, the program cannot be compiled as a device. Here we will introduce a method for cracking. I am referring to the weiphone Forum (xcode 3.1.4 certificate cracking + iPhone 3G 3.1.2 real machine deployment (same for 3.2.1 )), first, open the program-utility-key string in MacOSX, select the certificate assistant, create a certificate for code editing, and then execute the following commands to copy the certificate from weiphone forum.

Certificate forgery:

Follow the steps in this tutorial to add a certificate. Note: The original tutorial selects a "system" certificate. Here we use the "login" certificate. Remember.

Xcode cracking

Close xcode, open your command line terminal, and copy and paste the following code:

#! /Bin/bash

CD/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 = 255

Printf "\ x8f \ x2a \ x00 \ x00"> working

Dd If = iphoneos \ build \ System \ support of = working BS = 1 skip = 127504 seek = 127504

/Bin/MV-N iphoneos \ build \ System \ support. Original

/Bin/mv working iphoneos \ build \ System \ support

Chmod A + x iphoneos \ build \ System \ support

Copy and paste the following code to the command line terminal after execution: (Internet connection is required)

Mkdir/developer/iphoneentitlements30

CD/developer/iphoneentitlements30

Curl-O http://www.alexwhittemore.com/iphone/gen_entitlements.txt

MV gen_entitlements.txt gen_entitlements.py

Chmod 777 gen_entitlements.py

After the script is executed, modify the "/developer/platforms/iphoneos. Platform/info. plist" file and make the following changes:

Add the following two items:

Provisioning_profile_allowed = No

Provisioning_profile_required = No

Use a text editor to open "/developer/platforms/iPhone OS. platform/info. in the plist file, replace all "xciphoneoscodesigncontext" with "xccodesigncontext" (very important. If you do not perform this step, xcode opens the project file and reports an error and exits.) Save and exit.

Open xcode, open your project, project> edit project setting, select the "build" Page, select all for deployments and show, locate the code signing identity item, and delete its subitem, assign "code signing identity" to "iPhone developer" (which is actually an option ).

Then find the xxx-Info.plist file for your project and add the "signeridentity" item with the value "Apple iPhone OS application signing". Save.

During this period, we will choose to sign the certificate. After clicking "allow", it is said that the certificate cannot be permanently clicked.

OK. Click build and archive again !!

Package IPA

The compiled program is the helloipad. app folder. We need to create an IPA installation package to facilitate installation on the iPad.

Step 1: Create a folder with any name. Find a jpg image of no more than 500*500 and rename it itunesartwork. Note that no suffix is available.

Step 2: Create a folder named payload and copy the compiled helloipad. app to this folder.

Third, modify the info.plistfile in the append. You can use pledit.exe to edit the file in windows and add the following content to the <dict> </dict> node:

<Key> signeridentity </key>

<String> Apple iPhone OS application signing </string>

Select payload and itunesartwork, right-click to produce the compressed zip file, for example, helloipad.zip, and change the suffix to IPA. Now you can double-click the helloipad. IPA file to see if you can add it to iTunes.

(Ignore the one on the side. The one with my son's portrait is just packed)

Real machine running

If you want to use iTunes to synchronize the IPA file or use other methods, you can just install the file on a real machine. The running interface is as follows:

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.