Preparing Your System and iPhone for Development

9/14/2010 9:24:17 AM

What You’ll Learn in This Hour:

  • What makes an iPhone an iPhone

  • Where to get the tools you need to develop for the iPhone

  • How to join the iOS Developer Program

  • The need for (and use of) provisioning profiles

  • What to expect during the first few hours of this book

The iPhone opens up a whole realm of possibilities for developers—a multitouch interface, always-on Internet access, video, and a whole range of built-in sensors can be used to create everything from games to serious productivity applications. Believe it or not, as a new developer, you have an advantage. You will be starting fresh, free from any preconceived notions of what is possible in a handheld application. Your next big idea may well become the next big thing on Apple’s App Store.

This hour will get you prepared for iPhone development. You’re about to embark on the road to becoming an iPhone developer, but ’you need to do a bit of prep work before you start coding.

Welcome to the iOS Platform

If you’re reading this book, you probably already have an iPhone, and that means you already understand how to interact with its interface. Crisp graphics, amazing responsiveness, multitouch, and hundreds of thousands of apps—this just begins to scratch the surface. As a developer, however, you’ll need to get accustomed to dealing with a platform that, to borrow a phrase from Apple, forces you to “think different.”

Display and Graphics

The iPhone screen is 320×480 points—giving you a limited amount of space to present your application’s content and interface (see Figure 1). Notice that I said “points”, and not pixels! Prior to the release of the iPhone 4’s Retina display, the iPhone was 320×480 pixels. Now, the actual resolution of an iOS device is abstracted behind a scaling factor. This means that while you will be working the numbers 320×480 for positioning elements, you may have more pixels than that. The iPhone 4, for example, has a scaling factor of 2, which means that it is really a (320×2)×(480×2) or 640×960 resolution device. Although that might seem like quite a bit of screen real estate, remember that all these pixels are displayed in a screen that is roughly 3.5-inch″ diagonal.

Figure 1. The iPhone screen is measured in points—320×480 (portrait), 480×320 (landscape)—but each point may be made up of more than 1 pixel.

320 points

480 points

Did You Know?

We’ll look more at how scaling factors work when we position objects on the screen throughout the book. The important thing to know is that when you’re building your applications, the iOS will automatically take the scaling factor into play to display your apps and their interfaces at the highest possible resolution with rarely any additional work on your part!

Although this might seem limiting, consider that desktop computers only recently exceeded this size and many websites are still designed for 800×600. In addition, the iPhone’s display is dedicated to the currently running application. You will have one window to work in. You can change the content within that window, but the desktop and multiwindow application metaphors are gone.

The screen limits aren’t a bad thing. As you’ll learn, the iPhone development tools give you plenty of opportunities to create applications with just as much depth as your desktop software—albeit with a more structured and efficient interface design.

The graphics that you display on your screen can include complex animated 2D and 3D displays thanks to the OpenGL ES implementation available on all iPhone models. OpenGL is an industry standard for defining and manipulating graphic images that is widely used when creating games. The iPhone 3GS and 4 improve these capabilities with an updated 3D chipset and more advanced version of OpenGL (ES 2.0), but all the models have very respectable imaging abilities.

Application Resource Constraints

As with the HD displays on our desktops and laptops, we’ve grown accustomed to processors that can work faster than we can click. The iPhone uses a ~400MHz ARM in the early models, a ~600MHz version in the 3GS, and a 1GHz A4 in the iPhone 4. The A4 is a “system on a chip” that provides CPU, GPU, and other capabilities to the device and is the first Apple-designed CPU to be used in quite a while.

Apple has gone to great lengths to keep the iPhone responsive regardless of what you’re doing. Unfortunately, that means that unlike the Mac OS, your iPhone’s capability to multitask is limited. In iOS 4, Apple has created a limited set of multitasking APIs for very specific situations. These enable you to perform some tasks in the background, but your application can never assume that it will remain running. The iOS preserves the user experience beyond above all else.

Another constraint that you’ need to be mindful of is the available memory. In the original and iPhone 3G devices, 128MB of RAM is available for the entire system, including your application. There is no virtual memory, so you must carefully manage the objects that your application creates. In the iPhone 3GS Apple upped the ante to 256MB and, with the iPhone 4, Apple has graciously provided 512MB! This is great for us, but keep in mind that there are no RAM upgrades for earlier models!

By the Way

Throughout the book, you’ll see reminders to “release” memory when you’re done using it. Even though you might get tired of seeing it, this is a very important process to get used to.


The iPhone has the ability to always be connected to the Internet via a cellular provider (such as AT&T in the United States). This wide-area access is supplemented with built-in WiFi and Bluetooth in all iPhone models. WiFi can provide desktop-like browsing speeds within the range of a wireless hot spot. Bluetooth, on the other hand, can be used to connect a variety of peripheral devices to your iPhone, including a keyboard!

As a developer, you can make use of the Internet connectivity to update the content in your application, display web pages, and create multiplayer games. The only drawback is that applications that rely heavily on 3G data usage stand a greater chance of being rejected from the App Store. These restrictions have been lessened in recent months, but it is still a point of frustration for developers.

Input and Feedback

The iPhone shines when it comes to input and feedback mechanisms and your ability to work with them. You can read the input values from the capacitive multitouch (five-finger!) screen, sense motion and tilt via the accelerometer and gyroscope (iPhone 4), determine where you are using the GPS (3G/3GS), see which way you’re facing with the digital compass (3GS and iPhone 4), and understand how the phone is being used with the proximity and light sensors. The phone itself can provide so much data to your application about how and where it is being used that the device itself truly becomes a controller of sorts—much like (but surpassing!) the Nintendo Wii.

The iPhone also supports capturing pictures and video (3GS and iPhone 4) directly into your applications, opening a realm of possibilities for interacting with the real world. Already applications are available that identify objects you’ve taken pictures of and that find references to them online (such as the Amazon Mobile app).

Finally, for each action your user takes when interacting with your application, you can provide feedback. This, obviously, can be visible feedback on the screen, or it can be high-quality audio and force feedback via vibration. As a developer, you can leverage all these capabilities (as ‘you’ll see learn this book).

That wraps up our quick tour of the iOS platform. Never before has a single device defined and provided so many capabilities for a developer. As long as you think through the resource limitations and plan accordingly, a wealth of development opportunities awaits you.

Did You Know?

Although this book targets the iPhone specifically, nearly all the information carries over to development for the iPod Touch and iPad. These systems differ in capabilities, such as support for a camera and GPS, but the development techniques are otherwise identical.

Top 10
Understanding HTML5 Tags (part 2) : Knowing How Tags Work
Understanding HTML5 Tags (part 1) : Parsing Code, Nesting Tags
Windows Server 2008 and Windows Vista : Migrating GPOs (part 2) - Migration Tables
Windows Server 2008 and Windows Vista : Migrating GPOs (part 1) - Migrating GPOs Across Domains
How To Back Up All Your Devices (Part 2)
How To Back Up All Your Devices (Part 1)
How To Choose An External Drive (Part 2)
How To Choose An External Drive (Part 1)
New Restrictions On Old Office Software (Part 2)
New Restrictions On Old Office Software (Part 1)
Most View
How To Enable Big Picture Mode In Steam
Windows Server 2008 : Transport-Level Security - Active Directory Rights Management Services
Programming .NET Components : Building a Distributed Application (part 4) - Administrative Type Registration, Administrative Configuration Example
The Hit List - Comprehensive Task Manager
Instagram Substitutes On Android (Part 2) - Cinemagram, Clik, Steam Mobile & TeamViewer
Web Security : Seeking Design Flaws - Testing Random Numbers, Abusing Repeatability
Windows Server 2008 R2 : Managing Remote Access to Your Server - Understand Remote Desktop Services
Programming .NET Components : Visual Studio 2005 and Security
Protecting Me
Android’s Security Model
Leveraging and Optimizing Search in SharePoint 2010 : Define Content Sources
Fishing For Chips
Windows Server 2003 : Configuring a Windows IPSec Policy (part 1) - Using the IPSec Policy Wizard to Create a Policy
The Connected BlackBerry : Connection Paths (part 2) - Mobile Data Service Connection, Wi-Fi Connection
MySQL for Python : Passing a query to MySQL
System Builder - The Future Of USB
Windows Phone 7 Development : Push Notifications - Implementing Toast Notifications
Asus GTX 660 Ti DirectCU II Top (Part 2)
Iphone SDK : Working with the Address Book Database - Accessing Multi-Value Properties
Work with IIS 7.0 : Delegate Rights Assignments