Beginning iPhone SDK: Programming with Objective-C

Overview

Everything you need to know to start creating native applications for the iPhone and iPod Touch

The iPhone SDK and the Xcode tools are the official Apple tools used for creating native iPhone applications. This information-packed book presents a complete introduction to the iPhone SDK and the Xcode tools, as well as the Objective-C language that is necessary to create these native applications. Solid coverage and real-world examples walk you through the process for developing ...

See more details below
Available through our Marketplace sellers and in stores.

Pick Up In Store Near You

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (17) from $1.99   
  • New (5) from $3.98   
  • Used (12) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$3.98
Seller since 2008

Feedback rating:

(1727)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
2010 Paperback New Ships out next day, click expedited for faster shipping.

Ships from: cadiz, KY

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$4.74
Seller since 2008

Feedback rating:

(1727)

Condition: New
2010 Paperback New Ships out next day, click expedited for faster shipping.

Ships from: cadiz, KY

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$21.98
Seller since 2008

Feedback rating:

(278)

Condition: New
0470500972 New item in stock, may show minimal wear from storage. May have remainder mark. I ship daily and provide tracking! 100% Money Back Guarantee!

Ships from: FORT MYERS, FL

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$21.98
Seller since 2013

Feedback rating:

(3)

Condition: New
PAPERBACK New 0470500972 New item in stock, may show minimal wear from storage. May have remainder mark. I ship daily and provide tracking! 100% Money Back Guarantee!

Ships from: LEHIGH ACRES, FL

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$51.71
Seller since 2014

Feedback rating:

(7)

Condition: New
Brand New US edition as listed. FRESH! We ship promptly with good, sturdy packaging! Ask for JR with any product questions!

Ships from: Stone Mountain, GA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Page 1 of 1
Showing All
Close
Sort by
Sending request ...

Overview

Everything you need to know to start creating native applications for the iPhone and iPod Touch

The iPhone SDK and the Xcode tools are the official Apple tools used for creating native iPhone applications. This information-packed book presents a complete introduction to the iPhone SDK and the Xcode tools, as well as the Objective-C language that is necessary to create these native applications. Solid coverage and real-world examples walk you through the process for developing mobile applications for the iPhone that can then be distributed through Apple's iTunes Application store.

The hands-on approach shows you how to develop your first iPhone application while getting you acquainted with the iPhone SDK and the array of Xcode tools. A thorough tutorial on the features and syntax of the Objective-C language helps you get the most out of the iPhone SDK, and an in-depth look at the features of the iPhone SDK enables you to maximize each of these features in your applications.

  • Provides an introductory look at how the iPhone SDK and Xcode tools work with the Objective-C language to create native iPhone applications
  • Familiarizes you with the latest version of the iPhone SDK and the newest Xcode tools that ship with Snow Leopard
  • Walks you through developing your first iPhone applications
  • Focuses on the features and syntax of the Objective-C language so that you can get the most out of the iPhone SDK

With this hands-on guide, you'll quickly get started developing applications for the iPhone with both the iPhone SDK and the latest Xcode tools.

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

Read More Show Less

Product Details

  • ISBN-13: 9780470500972
  • Publisher: Wiley, John & Sons, Incorporated
  • Publication date: 1/7/2010
  • Edition number: 1
  • Pages: 552
  • Product dimensions: 7.40 (w) x 9.20 (h) x 1.10 (d)

Meet the Author

Wei-Meng Lee is Founder of Developer Learning Solutions, a technology company specializing in hands-on training of the latest Microsoft and Apple technologies. He writes extensively for online publications and is the author of Professional Windows Vista Gadgets Programming and C# 2008 Programmer's Reference.
Read More Show Less

Read an Excerpt

Beginning iPhone SDK Programming with Objective-C


By Wei-Meng Lee

John Wiley & Sons

Copyright © 2010 John Wiley & Sons, Ltd
All right reserved.

ISBN: 978-0-470-50097-2


Chapter One

Getting Started with iPhone Programming

WHAT YOU WILL LEARN IN THIS CHAPTER

* How to obtain the iPhone SDK

* The components included in the iPhone SDK

* The Features of the development tools - Xcode, Interface Builder, iPhone Simulator

* The Capabilities of the iPhone Simulator

* The Architecture of the iPhone OS

* The Frameworks of the iPhone SDK

* The Limitations and characteristics of the iPhone

Welcome to the world of iPhone programming! That you are now holding this book shows that you are fascinated with the idea of developing your iPhone applications and want to join the ranks of those tens of thousands of developers whose applications are already deployed in the AppStore.

As the old Chinese adage says, "To accomplish your mission, first sharpen your tools." Successful programming requires you first of all to know your tools well. Indeed, this couldn't be more true for iPhone programming - you need to know quite a few tools before you can even get started. Hence, the goal of this chapter is to show you the various relevant tools and information you need to jump on the iPhone development bandwagon.

Without further ado, it's time to get down to work.

OBTAINING THE IPHONE SDK

To develop for the iPhone or iPod Touch, you first need to sign up as a Registered iPhone Developer at http://developer.apple.com/iphone/program/start/register/. The registration is free and provides you with access to the iPhone SDK and other resources that are useful for getting started.

After signing up, you can download the iPhone SDK (see Figure 1-1).

Before you install the iPhone SDK, make sure you satisfy the following system requirements:

* Only Intel Macs are supported, so if you have another processor type (such as the older G4 or G5 Macs), you're out of luck.

* You have updated your system with the latest Mac OS X release.

An iPhone/iPod Touch device is highly recommended, though not strictly necessary. To test your application, you can use the included iPhone Simulator. However, if you want to test certain hardware features like the camera, accelerometer, and such, you would need to use a real device.

When the SDK is downloaded, proceed with installing it (see Figure 1-2). You will be asked to accept a few licensing agreements and then select the destination folder in which to install the SDK.

If you have selected the default settings during the installation phase, after the installation you should be able to find the various tools installed in the /Developer/Applications folder (see Figure 1-3).

COMPONENTS OF THE IPHONE SDK

The iPhone SDK includes a suite of development tools to help you develop applications for your iPhone and iPod Touch. It includes:

* Xcode - the Integrated Development Environment (IDE) that allows you to manage, edit, and debug your projects.

* Dashcode - the Integrated Development Environment (IDE) that allows you to develop web-based iPhone applications and Dashboard Widgets. Dashcode is beyond the scope of this book.

* iPhone Simulator - provides a software simulator to simulate an iPhone on your Mac.

* Interface Builder - provides a visual editor for designing your user interfaces for your iPhone applications.

* Instruments - analysis tool to help you optimize your application in real-time.

The following sections discuss each tool in more detail.

Xcode

As mentioned, all the tools in the iPhone SDK are installed in the /Developer/Applications folder (when using the default settings). One of those tools is Xcode.

To launch Xcode, double-click the Xcode icon (refer to Figure 1-3). Alternatively, go the quicker route and use Spotlight: Simply type Xcode into the search box and Xcode should be in the Top Hit position.

After Xcode is launched, you see the Welcome screen, shown in Figure 1-4.

Using Xcode, you can develop different types of iPhone and Mac OS X applications (see Figure 1-5).

The IDE in Xcode provides many tools and features that make your development life much easier. One such feature is Code Completion (see Figure 1-6), which displays a pop-up list showing the available classes and members (such as methods, properties, and so on).

NOTE For a more comprehensive description of some of the most commonly used features in Xcode, refer to Appendix B.

iPhone Simulator

The iPhone Simulator (see Figure 1-7) is a very useful tool included in the iPhone SDK that you can use to test your application without using your actual iPhone/iPod Touch. The iPhone Simulator is located in the /Developer/iPhone OS /Platforms/ iPhoneSimulator.platform/Developer/Applications/ folder. Most of the time, you don't need to launch the iPhone Simulator directly - running (or debugging) your application in Xcode automatically brings up the iPhone Simulator. Xcode installs the application on the iPhone Simulator automatically.

The iPhone Simulator can simulate different versions of the iPhone OS (see Figure 1-8). This capability is very useful if you need to support older versions of the platform as well as testing and debugging errors reported in the application on specific versions of the OS.

Features of the iPhone Simulator

The iPhone Simulator simulates various features of a real iPhone or iPod touch device. Features you can test on the iPhone Simulator include:

* Screen rotation - left, top, and right

* Support for gestures:

* Tap

* Touch and Hold

* Double Tap

* Swipe

* Flick

* Drag

* Pinch

* Low-memory warning simulations

However, the iPhone Simulator, being a software simulator for the real device, does have its limitations. Features not available on the iPhone Simulator include:

* Obtaining location data - it returns only a fixed coordinate, such as Latitude 37.3317 North and Longitude 122.0307 West

* Making phone calls

* Accessing the Accelerometer

* Sending and receiving SMS messages

* Installing applications from the App Store

* Camera

* Microphone

* Several features of OpenGL ES

It is worth noting that the speed of the iPhone Simulator is more tightly coupled to the performance of your Mac, as opposed to how the actual device performs. Hence, it is important that you test your application on a real device rather than rely exclusively on the iPhone Simulator for testing.

Although you have limitations with the iPhone Simulator, it is definitely a useful tool to get your applications tested. That said, testing your application on a real iPhone or iPod touch device is imperative before you deploy it on the AppStore.

NOTE For a more detailed look at how you can test your application on a real device, refer to Appendix E.

Uninstalling Applications from the iPhone Simulator

The user domain of the iPhone OS file system for the iPhone Simulator is stored in the ~/Library/ Application Support/iPhone Simulator/User/ folder.

NOTE The ~/Library/Application Support/iPhone Simulator/User/ folder is also known as the .

All third-party applications are stored in the /Applications/ folder. When an application is deployed onto the iPhone Simulator, an icon is created on the Home screen (shown on the left in Figure 1-9) and a file and a folder are created within the Applications folder (shown on the right in Figure 1-9).

To uninstall (delete) an application, execute the following steps:

1. Click and hold the icon of the application in the Home screen until all the icons start wriggling. Observe that all the icons now have an "x" button displayed on their top left corners.

2. Click the x button (see Figure 1-10) next to the icon of the application you want to uninstall.

3. An alert window appears asking if you are sure you want to delete the icon. Click Delete to confirm the deletion.

WARNING When the application is uninstalled, the corresponding file and folder in the Applications folder are deleted automatically.

To reset the iPhone Simulator to its original state, the easiest way is to select the iPhone Simulator [??] Reset Content and Settings menu item.

Interface Builder

Interface Builder is a visual tool that allows you to design your user interfaces for your iPhone applications. Using Interface Builder, you drag and drop views on windows and then connect the various views with outlets and actions so that they can programmatically interact with your code.

NOTE Outlets and actions are discussed in more detail in Chapter 3.

Figure 1-11 shows the various windows in Interface Builder.

Appendix C discusses Interface Builder in more detail.

Instruments

The Instruments (see Figure 1-12) application allows you to dynamically trace and profile the performance of your Mac OS X and iPhone applications.

Using Instruments, you can:

* Stress test your applications

* Trace your applications for memory leaks

* Gain a deep understanding of the executing behavior of your applications

* Track difficult-to-reproduce problems in your applications

NOTE Covering the Instruments application is beyond the scope of this book. For more information, refer to Apple's documentation.

ARCHITECTURE OF THE IPHONE OS

Although this book doesn't explore the innards of the iPhone OS, understanding some of the important points of the iPhone OS is useful. Figure 1-13 shows the different abstraction layers that make up the Mac OS X and the iPhone OS.

NOTE The iPhone OS is architecturally very similar to the Mac OS X except that the topmost layer is the Cocoa Touch for iPhone instead of the Cocoa Framework.

The bottom layer is the Core OS, which is the foundation of the operating system. It is in charge of memory management, the file system, networking, and other OS tasks, and it interacts directly with the hardware. The Core OS layer consists of components such as:

* OS X Kernel

* Mach 3.0

* BSD

* Sockets

* Security

* Power Management

* Keychain

* Certificates

* File System

* Bonjour

The Core Services layer provides fundamental access to iPhone OS services. It provides an abstraction over the services provided in the Core OS layer. The Core Services layer consists of the following components:

* Collections

* Address Book

* Networking

* File Access

* SQLite

* Core Location

* Net Services

* Threading

* Preferences

* URL Utilities

The Media layer provides multimedia services that you can use in your iPhone applications. The Media layer consists of the following components:

* Core Audio

* OpenGL

* Audio Mixing

* Audio Recording

* Video Playback

* JPG, PNG, TIFF

* PDF

* Quartz

* Core Animation

* OpenGL ES

The Cocoa Touch layer provides an abstraction layer to expose the various libraries for programming the iPhone and iPod Touch, such as:

* Multi-Touch events

* Multi-Touch controls

* Accelerometer

* View Hierarchy

* Localization

* Alerts

* Web Views

* People Picker

* Image Picker

* Controllers

The iPhone SDK consists of the following frameworks shown in Table 1-1, grouped by functionalities.

NOTE A framework is a software library that provides specific functionalities.

SOME USEFUL INFORMATION BEFORE YOU GET STARTED

You now have a very good idea of the tools involved in iPhone application development. Before you go ahead and take the plunge, the following sections discuss some useful information that can make your journey a more pleasant one.

Versions of iPhone OS

At the time of writing, the iPhone OS is in its third revision - that is, version 3.0. The iPhone OS has gone through several revisions, and the major versions are as follows:

* 1.0 - initial release of iPhone

* 1.1 - additional features and bug fixes for 1.0

* 2.0 - released with iPhone 3G; comes with App Store

* 2.1 - additional features and bug fixes for 2.0

* 2.2 - additional features and bug fixes for 2.1

* 3.0 - third major release of the iPhone OS; see the next section for what is new in iPhone OS 3.0

For a detailed description of the features in each release, check out http://en.wikipedia .org/wiki/IPhone_OS_version_history.

Testing on Real Devices

One of the most common complaints that beginning iPhone programmers made was about the inability to test iPhone applications they have developed on their actual devices. It seems odd that as the owner of the device, they can't even test their applications on it. Turns out that for security reasons, Apple requires all applications to be signed with a valid certificate, and for testing purposes, a developer certificate is required.

To test your applications on a device, you must sign up for the iPhone Developer program and request that a developer certificate be installed onto your device. This is a lengthy process, but I give you detailed help with it in Appendix E.

Screen Resolution

The iPhone is a beautiful device with a high-resolution screen. At 3.5 inches (diagonally), the iPhone screen supports multitouch operation and allows a pixel resolution of 480 x 320 at 163 ppi (see Figure 1-14). When designing your application, note that despite the 480 x 320 resolution, most of the time you're limited to 460 x 320 pixels because of the status bar. Of course, you can turn off the status bar programmatically and gain access to the full 480 x 320 resolution.

Also, be mindful that users may rotate the device to display your application in Landscape mode. In that case, you have to make provisions to your user interface so that the applications can still work properly in Landscape mode should you decide to support the new orientation.

NOTE Chapter 6 discusses how to handle screen rotations.

Single-Window Applications

If you are new to mobile programming, you need to be aware that the limited screen real estate means that most mobile platforms support only single-window applications - that is, your application window occupies the entire screen. The iPhone is no exception to this platform limitation. Overlapping windows that are so common in desktop operating systems (such as Mac OS X and Windows) are not supported on the iPhone.

No Background Applications

One of the major challenges in programming mobile devices is power management. A badly written application can be a resource hog and will drain the battery of the device very quickly. Apple acknowledges this issue, and from reviewing experiences obtained from other platforms, decided that major culprits in hurting battery life and performance are background applications. On other platforms (such as Windows Mobile), when an application goes out of view (because of an incoming call, for example), the application remains in memory, and each background application retained in memory continues to takes its toll on the device's performance and battery life.

Apple's solution to this problem is simple: Disallow applications to run in the background. Although this is an effective solution, it has irked a lot of developers. Many useful applications require background operation to function correctly. For example, a chatting application needs to be running to receive messages from other users. To overcome this limitation, Apple has developed its Push Notification Service, which feeds applications with data even when they are not running. This service was released with iPhone 3.0. Using push technology, a device is constantly connected to Apple's server through an IP connection. When a device needs attention, a notification is sent from Apple's server to the device, thereby alerting the specific application that needs to service that notification.

NOTE Push notification is beyond the scope of this book. For more information, visit Apple's iPhone Dev Center at http://developer.apple.com/iphone/ index.action.

Restrictions on Calling Third-Party Applications

Another restriction that Apple places on iPhone developers is that you are not allowed to call third-party applications from within your application. In addition, you can't run interpreted code from within your application. A good example involves writing a Web browser application for the iPhone. Because Web applications typically use JavaScript for client-side interactivity, this restriction by Apple means that you can't run JavaScript code from within your application.

(Continues...)



Excerpted from Beginning iPhone SDK Programming with Objective-C by Wei-Meng Lee Copyright © 2010 by John Wiley & Sons, Ltd. Excerpted by permission.
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.

Read More Show Less

Table of Contents

INTRODUCTION.

PART I GETTING STARTED.

CHAPTER 1 Getting Started with iPhone Programming.

CHAPTER 2 Write Your First Hello World! Application.

CHAPTER 3 Outlets, Actions, and View Controllers.

CHAPTER 4 Exploring the Views.

CHAPTER 5 Keyboard Inputs.

CHAPTER 6 Screen Rotations.

PART II BUILDING DIFFERENT TYPES OF IPHONE APPLICATIONS.

CHAPTER 7 View Controllers.

CHAPTER 8 Tab Bar and Navigation Applications.

CHAPTER 9 Utility Applications.

PART III DISPLAYING AND PERSISTING DATA.

CHAPTER 10 Using the Table View.

CHAPTER 11 Application Preferences.

CHAPTER 12 Database Storage Using SQLite3.

CHAPTER 13 File Handling.

PART IV ADVANCED IPHONE PROGRAMMING TECHNIQUES.

CHAPTER 14 Programming Multi-touch Applications.

CHAPTER 15 Simple Animations.

CHAPTER 16 Accessing Built-in Applications.

CHAPTER 17 Accessing the Hardware.

PART V APPENDICES.

APPENDIX A Answers to Exercises.

APPENDIX B Getting Around in Xcode.

APPENDIX C Getting Around in Interface Builder.

APPENDIX D Crash Course in Objective-C.

APPENDIX E Testing on an Actual iPhone or iPod Touch.

INDEX.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)