Signing up to be an iOS developer

In this article by Miguel DeQuadros, author of the book Mastering IOS Game Development, we will get you signed up to be an Apple developer.

Let's dive right into registering to be an iOS developer, shall we?

(For more resources related to this topic, see here.)

Registering to be an iOS developer

As with many platforms (Mac, PC, Android, Blackberry, and Windows Mobile), iOS requires you to sign up to be a developer. Don't worry! It's super easy; simply go to www.developer.apple.com, where you will see the following:

Mastering IOS Game Development

Scroll down to Download the latest development tools and SDKs, under which you will find iOS Apps. Click on the iOS Apps button, and you will be greeted with the iOS Dev Center, get used to this site as well as iTunes Connect, which we will get into later in this article; we will use these sites a lot during our mobile game development.

If you don't have a developer account, click on the register for freetext so that we can get signed up. Another great thing about Apple is that their accounts are all linked, so when you register for a developer account, you can use your Apple ID. On the next screen, you will be asked to either sign in with your Apple ID or create a new one. Simply follow the prompts, fill in all your information, and pay the annual fee ($99 USD/ $119 CAD). When you're done, you should have access to the SDK. If you weren't redirected to the iOS Dev Center again, go to www.developer.apple.com/ios and scroll down to the Downloads section. As of this writing, the current version of Xcode is 6.2. Click on the Download button. You will be brought to a download screen, which just basically says, "You've kinda come to the right place, but really go here to download Xcode"; it's more polite then that though. Xcode is now hosted on the Mac AppStore, which is a lot better because it automatically updates Xcode when required.

Mastering IOS Game Development

Click on the Get button to download Xcode. When it's done downloading (it will probably take a while, unless you have super dooper fibre optic extreme gigawatt Internet, but for those who have normal the Internet, it will take a while as it is 2.5 GB), the AppStore will automatically install Xcode for you. Great!

Now you should have a glittery new icon on your dock. Open it, and it may prompt you to do an additional installation to support debugging or what not. Go ahead and let it download any extra components needed, as shown in the following screenshot:

You will now be greeted with the Xcode welcome screen. From here, you can create new projects, open old ones, and even see a list of recent projects.

We will start setting up our game project, so click on Create a new Xcode project, after which the new project wizard will pop up. From here, you have a lot of empty project templates you can choose from, but for this project, we will select the Game template under the iOS selection, in the Application tab. Click on Game, then click on Next. The next screen will ask for all the game info, which is broken down like this:

  • Product Name: This is the name of the project or game.
  • Organization Name: This is the name of the company or your personal name that you used when signing up with the Apple developer site.
  • Organization Identifier: This will show up in your bundle identifier (certificates will be discussed later). Usually, certificates read com.yourcompany.yourproduct, but you can customize it to be yourcompany.yourproduct.
  • Bundle Identifier: This is the identifier for your project. You will see this on the developer certificates that we will install later, and you will also see it when you upload it to the AppStore.
  • Language: There are now two languages Swift and Objective-C, which we can choose from when developing mobile game. For this article, we will use Objective-C.
  • Game Technology: There various "kits" that you can use when developing, SceneKit, SpriteKit, OpenGL ES, and Metal. For this project, we will select SpriteKit.
  • Devices: The default device is Universal; however, if you want to select your target device, you can. Sometimes an iPad app won't look right on the iPhone!

The following screenshot illustrates the preceding options for the game info:

To recap, for this project, we will select Objective-C, SpriteKit and Universal. When you have filled out all your information, click on the Next button and save your project in a location that's easy to remember.

Now you are in Xcode! Confused by what you see? Don't worry, it's actually pretty easy to navigate.

What you see in the previous image are the general project settings; this is the first thing you see when you load an Xcode project. For this project, we only want to support the landscape orientations. So, under the Deployment Info section, under Device Orientation, deselect the Portrait option and leave the two landscape orientations checked.

If you want, you can add different capabilities to our game. Click on the Capabilities button on the top of the bar in the center of the screen; here, you will see a ton of different options you can add to your app. For example, we can add Game Center for leader boards and achievements, or we can add iCloud to store data remotely, as shown in the following screenshot:

There are a lot of settings and variables that can be changed in the various sections of the top bar, we will get into some of them later on in this article.

Let's take a look around our project files to familiarize with the functions of the files. On the left-hand side bar, you will see the .h and .m files, these is where all your programming will go.

The .h files are your header files. We will declare variables (such as integers and Booleans) and outlets (if we were building through the storyboard, you would declare buttons, labels, and a lot more. We would declare them in the header file, and connect them in the storyboard).

The .m file is your main file; this is where the majority of the coding is done Declarations made in the header files are accessible as long as it's the same set of files, for example, you can access an integer from AppDelegate.hin the AppDelegate.m file. There are ways to access variables from other files, such as frameworks, or as long as you import the header files into the files you are working on; again we will discuss this later. I don't want to confuse you at this point.

Let's look at the AppDelegate.h and AppDelegate.m files. First, in the .h file. You will see the following code:

//
//AppDelegate.h
//SuperSolderBoys
//
//Created by Miguel DeQuadros on 2015-03-25.
//Copyright (c) 2015 Miguel DeQuadros. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;


@end

There will be variations in the text that is commented out (you can comment the text by typing // followed by the comment. You will know text is commented out when it is green in color).

Pretty much all code files will begin with importing files. The AppDelegate.h file seen in the preceding code shows #import <UIKit/UIkit.h>, which will allow you to access commands and functions from the UIKit headers. You can import anything here, for example, if you want to create an app with PayPal payment in it, you can import the PayPal SDK, then import it into your file by typing #import <PayPal/PayPal.h> or whatever the file is that needs to be imported. When you start typing, Xcode will show you a list of files that you can import.

The @interface AppDelegate : UIResponder <UIApplicationDelegate> line is next. This line will vary depending on the type of interface you are working with, it can be an ApplicationDelegate method like we have in this file, or it can be a UIViewController class, or an SKScene function. Again, it depends on the type of interface you are working with. You will see a variation of them throughout this article.

The line @property (strong, nonatomic) UIWindow *window; is the next line. This is where your declarations will be made. This line declares the app window.

Finally, we have the @end line, which is simply the end of the file.

Now, in the .M file, you will see the following code:

//
//  AppDelegate.m
//  SuperSolderBoys
//
//  Created by Miguel DeQuadros on 2015-03-25.
//  Copyright (c) 2015 Miguel DeQuadros. All rights reserved.
//

#import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end

In this file, you will call various functions when the application reaches certain states. If you read through some of the functions, you will see things like when the application is terminated, or when it enters the background. In these functions, you can save data, log information, or even pause the game.

Seems fairly simple right? Once you get the hang of things, it really is!

We now have to add your developer account to the Xcode account preferences. This makes signing certificates and provisioning profiles much easier.

To add your account, click on Xcode in the top bar (where you see the file, edit it, and do all that fun stuff) and then click on Preferences. Alternatively, you can press cmd + for quick access to the menu.

When the preferences window appears, click on the Accounts tab, which is the second tab in the window.

In the lower-left corner of the window, click on the + button to add an account, when the drop-down menu appears, select Add Apple ID.

Again Xcode uses your normal Apple ID login to sign in to the Developer's Member Center and iTunes Connect, which is super convenient because you don't have to remember multiple logins. You will see the window as shown in the following screenshot:

Now that you've added your account to Xcode, we need to add all the developer certificates into your key chain.

Go to developer.apple.com, click on Member Center, then log in using your Apple ID. Under the Technical Resources and Tools section, click on the Certificates, Identifiers & Profiles icon.

You will now see a selection for iOS, Mac, and Safari. These will show all your certificates for each platform organized all nice and neat.

Click on the Certificates icon under iOS, and if your membership is new, you will be greeted with a Getting Started webpage. Simply follow all the steps, which will guide you into the creation and installation of the certificates.

When you have all your certificates installed, you're all done

Summary

In this article, we signed up to become an iOS developer, and we discussed setting up the certificates so that we can begin development of our awesome game! We had a quick overview of Xcode and saw how the coding files work.

Resources for Article:


Further resources on this subject:


You've been reading an excerpt of:

Mastering iOS Game Development

Explore Title