Tuesday, 10 March 2015

Creating and Running Our First iOS App



Before we dive any deeper into the features of Objective-C, we should have a brief look at how to create a simple iOS app in Xcode. Xcode is Apple’s IDE (integrated develop‐ ment environment) that allows you to create, build, and run your apps on iOS Simulator and even on real iOS devices. We will talk more about Xcode and its features as we go along, but for now let’s focus on creating and running a simple iOS app. I assume that you’ve already downloaded Xcode into your computer from the Mac App Store. Once that step is taken care of, please follow these steps to create and run a simple iOS app: 1. Open Xcode if it’s not already open. 2. From the File menu, choose New Project... 3. In the New Project window that appears, on the lefthand side under the iOS cate‐ gory, choose Application and then on the right hand side choose Single View Application. Then press the Next button. 4. On the next screen, for the Product Name, enter a name that makes sense for you. For instance, you can set the name of your product as My First iOS App. In the
Organization Name section, enter your company’s name, or if you don’t have a company, enter anything else that makes sense to you. The organization name is quite an important piece of information that you can enter here, but for now, you don’t have to worry about it too much. For the Company Identifier field, enter com.mycompany. If you really do own a company or you are creating this app for a company that you work with, replace mycompany with the actual name of the com‐ pany in question. If you are just experimenting with development on your own, invent a name. For the Devices section, choose Universal. 5. Once you are done setting the aforementioned values, simply press the Next button. 6. You are now being asked by Xcode to save your project to a suitable place. Choose a suitable folder for your project and press the Create button. 7. As soon as your project is created, you are ready to build and run it. However, before you begin, make sure that you’ve unplugged all your iOS devices from your com‐ puter. The reason behind this is that once an iOS device is plugged in, by default, Xcode will attempt to build and run your project on the device, causing some issues with provisioning profiles (which we haven’t talked about yet). So unplug your iOS devices and then press the big Run button on the top-lefthand corner of Xcode. If you cannot find the Run button, go to the Product menu and select the Run menu item. Voilà! Your first iOS app is running in iOS Simulator now. Even though the app is not exactly impressive, simply displaying a white screen in the simulator, this is just the first step toward our bigger goal of mastering the iOS SDK, so hold on tight as we embark on this journey together.

No comments:

Post a Comment