Note: This Objective-C topic is a prelude to iOS development. It also helps programmers with experience in object-oriented language development to quickly get started with Objective-C. If you have no programming experience or are not interested in Objective-C or iOS development, ignore this. Before learning this topic, we recommend that you first study the C language topic.
1. Open Xcode and create an Xcode Project
2. Select the simplest Command Line Project
Because we only learned the OC syntax and haven't officially started iOS development, select the command line project.
3. Enter a project name and select Foundation framework to create a project.
* You must select the Foundation framework for Type, because common classes of OC are included in this framework.
* Do not select the "Use Automation..." option at the bottom, which is related to memory management. Let's talk about memory management.
4. Click Run to Run the project.
* C language source file extension name ". c", OC source file extension name ". m"
* The main. m file is the only source file in our program.
* The compiler will compile the. m file as the. o target file. For example, after main. m is compiled successfully, it will become the main. o file.
* The running result is:
15:35:32. 583 the first OC program [429: 303] Hello, World!
The first OC program runs successfully!