Home > Store

iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK

Register your product to gain access to bonus material or receive a coupon.

iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK

eBook (Watermarked)

  • Your Price: $28.79
  • List Price: $35.99
  • Includes EPUB, MOBI, and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    MOBI MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Description

  • Copyright 2014
  • Dimensions: 7" x 9"
  • Edition: 1st
  • eBook (Watermarked)
  • ISBN-10: 0-13-308691-7
  • ISBN-13: 978-0-13-308691-1

Take Your Next Leap Forward as an iOS App Developer! Covers iOS 7 and Xcode 5

iOS Components and Frameworks will help you leverage iOS’s powerful components and frameworks to build apps with outstanding performance, reliability, interactivity, media support, and customization.

Pioneering iOS developers Kyle Richter and Joe Keeley illuminate the sophisticated intermediate-to-advancedlevel techniques you’re now ready for. You’ll find example-rich coverage of topics ranging from social support to security, Core Data, TextKit, iCloud support, UIKit Dynamics, MapKit, and Passbook. There’s also a complete section on advanced performance and security, including the effective use of Grand Central Dispatch and Keychain.

Each chapter contains a complete sample project that walks you through integrating its technology into a typical iOS app. You’ll discover how multiple iOS features can be combined into exceptionally powerful apps and walk through a complete case study project: a fully functional game with complete Game Center integration.

Coverage includes:

  • New physics-based animation effects provided by UIKit Dynamics
  • Making the most of Core Location, MapKit, and Geofencing
  • Leveraging Game Center features such as Leader Boards and Achievements
  • Giving users access to their address and media libraries from within your app
  • Using lightweight JSON to move data among servers, apps, and websites
  • Syncing apps via iCloud using UIDocument and key-value store syncing
  • Securing user data with Keychain
  • Informing users of important app-related events via Notifications
  • Storing and retrieving persistent data locally with Core Data
  • Using advanced Objective-C features to write more manageable, concise apps
  • Improving responsiveness through concurrency with Grand Central Dispatch
  • Advanced text handling and display with TextKit
  • Smoothly handling complex and continuous gestures
  • Effective debugging techniques with Xcode 5 and Instruments
  • Building passes for Passbook and PassKit

If you’re a serious iOS developer who wants to build cutting-edge apps, iOS Components and Frameworks delivers the practical skills, reusable code, and expert insights you’re looking for.

Sample Content

Table of Contents

1  UIKit Dynamics     1

Sample App     1

Introduction to UIKit Dynamics     2

Implementing UIKit Dynamics     3

  Gravity     3

  Collisions     4

  Attachments     6

  Springs     8

  Snap     9

  Push Forces     9

  Item Properties     11

In-Depth UIDynamicAnimator and UIDynamicAnimatorDelegate     13

Summary     13

Exercises     14

2  Core Location, MapKit, and Geofencing     15

The Sample App     15

Obtaining User Location     15

  Requirements and Permissions     16

  Checking for Services     19

  Starting Location Request     20

  Parsing and Understanding Location Data     22

  Significant Change Notifications     23

  Using GPX Files to Test Specific Locations     24

Displaying Maps     26

  Understanding the Coordinate Systems     26

  MKMapKit Configuration and Customization     26

  Responding to User Interactions     28

Map Annotations and Overlays     29

  Adding Annotations     29

  Displaying Standard and Custom Annotation Views     32

  Draggable Annotation Views     35

  Working with Map Overlays     36

Geocoding and Reverse-Geocoding     37

  Geocoding an Address     37

  Reverse-Geocoding a Location     41

Geofencing     44

   Checking for Regional Monitoring Capability     44

   Defining Boundaries     45

   Monitoring Changes     46

Getting Directions     48

Summary     52

Exercises     53

3  Leaderboards     55

Whack-a-Cac     55

  Spawning a Cactus     57

  Cactus Interaction     60

  Displaying Life and Score     62

  Pausing and Resuming     63

  Final Thoughts on Whack-a-Cac     64

iTunes Connect     65

Game Center Manager     68

Authenticating     70

  Common Authentication Errors     71

  iOS 6 Authentication     73

Submitting Scores     75

  Adding Scores to Whack-a-Cac     78

  Presenting Leaderboards     80

  Score Challenges     82

  Going Further with Leaderboards     84

Summary     86

Exercises     86

4  Achievements     87

iTunes Connect     87

Displaying Achievement Progress     89

Game Center Manager and Authentication     91

The Achievement Cache     91

Reporting Achievements     93

Adding Achievement Hooks     95

  Completion Banners     96

  Achievement Challenges     97

  Adding Achievements into Whack-a-Cac     100

  Earned or Unearned Achievements     101

  Partially Earned Achievements     102

  Multiple Session Achievements     104

  Piggybacked Achievements and Storing Achievement Precision     105

  Timer-Based Achievements     106

Resetting Achievements     107

Going Further with Achievements     108

Summary     110

Exercises     110

5  Getting Started with Address Book     111

Why Address Book Support Is Important     111

Limitations of Address Book Programming     112

Introduction to the Sample App     112

Getting Address Book Up and Running     112

  Reading Data from the Address Book     115

  Reading Multivalues from the Address Book     116

  Understanding Address Book Labels     117

  Working with Addresses     118

Address Book Graphical User Interface     120

  People Picker     120

Programmatically Creating Contacts     125

Summary     128

Exercises     128

6  Working with Music Libraries     129

Introduction to the Sample App     129

Building a Playback Engine     131

  Registering for Playback Notifications     131

  User Controls     133

  Handling State Changes     135

  Duration and Timers     139

  Shuffle and Repeat     140

Media Picker     141

Programmatic Picker     143

  Playing a Random Song     144

  Predicate Song Matching     145

Summary     147

Exercises     148

7  Working with and Parsing JSON     149

JSON     149

  Benefits of Using JSON     149

  JSON Resources     150

Sample App Overview     150

Accessing the Server     150

Getting JSON from the Server     151

  Building the Request     151

  Inspecting the Response     152

  Parsing JSON     153

  Displaying the Data     154

Posting a Message     155

  Encoding JSON     156

  Sending JSON to the Server     158

Summary     159

Exercise     159

8  Getting Started with iCloud     161

The Sample App     161

Setting Up the App for iCloud Support     162

  Account Setup     162

  Enabling iCloud Capabilities     163

  Initializing iCloud     164

Introducing UIDocument     165

  Subclassing UIDocument     165

  Interacting with UIDocument     167

Interacting with iCloud     168

  Listing Documents in iCloud     168

  Detecting Conflicts in iCloud     172

Conflict Resolution     173

Key-Value Store Syncing     178

Summary     180

Exercises     180

9  Notifications     181

Differences Between Local and Push Notifications     181

Sample App     182

App Setup     182

Create Development Push SSL Certificate     184

Development Provisioning Profile     188

Custom Sound Preparation     194

Registering for Remote Notifications     194

Scheduling Local Notifications     196

Receiving Notifications     196

Push Notification Server     198

Basic Rails Setup     198

Add Support for Devices and Shouts     199

Device Controller     202

Shout Controller     202

Tying It All Together     204

Sending the Push Notifications     207

Handling APNs Feedback     207

Summary     208

Exercise     208

10  Bluetooth Networking with Game Kit     209

Limitations of Game Kit’s Bluetooth Networking     209

Benefits of Game Kit’s Bluetooth Networking     210

Sample App     210

The Peer Picker     215

Sending Data     218

  Data Modes     219

  Sending Data in the Sample App     219

Receiving Data     221

  Receiving Data in the Sample App     221

State Changes     222

Advanced Features     223

  Peer Display Name     223

  Connecting Without the Peer Picker     223

  Session Modes     225

Summary     225

Exercises     225

11  AirPrint     227

AirPrint Printers     227

Testing for AirPrint     229

Printing Text      229

  Print Info     230

  Setting Page Range     231

  Error Handling     232

  Starting the Print Job     232

  Print Simulator Feedback     233

Print Center     234

  UIPrintInteractionControllerDelegate     234

Printing Rendered HTML     236

Printing PDFs     237

Summary     239

Exercises     239

12  Core Data Primer     241

Deciding on Core Data     242

Core Data Managed Objects     243

  Managed Objects     243

  Managed Object Model     244

  Managed Object Model Migrations     246

  Creating Managed Objects     246

  Fetching and Sorting Objects     247

  Fetched Results Controller     248

The Core Data Environment     248

  Persistent Store Coordinator     249

  Persistent Store     249

  Managed Object Context     249

Summary     250

13  Getting Up and Running with Core Data     251

Sample App     251

Starting a Core Data Project     252

  Core Data Environment     254

Building Your Managed Object Model     256

  Creating an Entity     257

  Adding Attributes     257

  Establishing Relationships     258

  Custom Managed Object Subclasses     259

Setting Up Default Data     260

  Inserting New Managed Objects     260

  Other Default Data Setup Techniques     261

Displaying Your Managed Objects     262

  Creating Your Fetch Request     262

  Fetching by Object ID     264

  Displaying Your Object Data     265

  Using Predicates     267

Introducing the Fetched Results Controller     268

  Preparing the Fetched Results Controller     268

  Integrating Table View and Fetched Results Controller     271

  Responding to Core Data Changes     273

Adding, Editing, and Removing Managed Objects     275

  Inserting a New Managed Object     275

  Removing a Managed Object     276

  Editing an Existing Managed Object     277

  Saving and Rolling Back Your Changes     278

Summary     279

Exercises     279

14  Language Features     281

Literals     282

  Boxed Expressions     284

Automatic Reference Counting     285

  Using ARC in a New Project     285

  Converting an Existing Project to ARC     286

  Basic ARC Usage     288

  ARC Qualifiers     289

Blocks     290

  Declaring and Using Blocks     290

  Capturing State with Blocks     291

  Using Blocks as Method Parameters     293

  Memory, Threads, and Blocks     294

Properties     295

  Declaring Properties     295

  Synthesizing Properties     297

  Accessing Properties     297

  Dot Notation     298

  Fast Enumeration     298

Method Swizzling     299

Summary     302

Exercises     302

15  Integrating Twitter and Facebook Using Social Framework     303

Social Integration     303

The Sample App     303

Logging In     304

Using SLComposeViewController     306

Posting with a Custom Interface     308

  Posting to Twitter     308

  Posting to Facebook     312

  Creating a Facebook App     312

Accessing User Timelines     318

  Twitter     318

  Facebook     324

Summary     328

Exercises     328

16  Working with Background Tasks     329

The Sample App     330

Checking for Background Availability     330

Finishing a Task in the Background     331

  Background Task Identifier     332

  Expiration Handler     333

  Completing the Background Task     333

Implementing Background Activities     335

  Types of Background Activities     335

  Playing Music in the Background     336

Summary     340

Exercises     340

17  Grand Central Dispatch for Performance     341

The Sample App     341

Introduction to Queues     343

Running on the Main Thread     343

Running in the Background     345

Running in an Operation Queue     347

  Concurrent Operations     347

  Serial Operations     349

  Canceling Operations     350

  Custom Operations     351

Running in a Dispatch Queue     353

  Concurrent Dispatch Queues     353

  Serial Dispatch Queues     355

Summary     357

Exercises     358

18  Using Keychain to Secure Data     359

Introduction to the Sample App     360

Setting Up and Using Keychain     360

  Setting Up a New KeychainItemWrapper     361

  Storing and Retrieving the PIN     362

  Keychain Attribute Keys     363

  Securing a Dictionary     364

  Resetting a Keychain Item     366

  Sharing a Keychain Between Apps     367

  Keychain Error Codes     368

Summary     368

Exercises     369

19  Working with Images and Filters     371

The Sample App     371

Basic Image Data and Display     371

  Instantiating an Image     372

  Displaying an Image     373

  Using the Image Picker     375

  Resizing an Image     378

Core Image Filters     379

  Filter Categories and Filters     379

  Filter Attributes     382

  Initializing an Image     384

  Rendering a Filtered Image     385

  Chaining Filters     386

Face Detection     387

  Setting Up a Face Detector     388

  Processing Face Features     388

Summary     390

Exercises     391

20  Collection Views     393

The Sample App     393

Introducing Collection Views     394

  Setting Up a Collection View     395

  Implementing the Collection View Data Source Methods     396

  Implementing the Collection View Delegate Methods     399

Customizing Collection View and Flow Layout     401

  Basic Customizations     401

  Decoration Views     402

Creating Custom Layouts     406

Collection View Animations     411

  Collection View Layout Changes     411

  Collection View Layout Animations     412

  Collection View Change Animations     414

Summary     415

Exercises     415

21  Introduction to TextKit     417

Sample App     417

  Introducing NSLayoutManager     418

NSTextStore     418

Detecting Links Dynamically     421

Detecting Hits     422

Exclusion Paths     423

Content Specific Highlighting     425

Changing Font Settings with Dynamic Type     429

Summary     431

Exercises     431

22  Gesture Recognizers     433

Types of Gesture Recognizers     433

Basic Gesture Recognizer Usage     434

Introduction to the Sample App     434

  Tap Recognizer in Action     435

  Pinch Recognizer in Action     436

Multiple Recognizers for a View     438

  Gesture Recognizers: Under the Hood     440

  Multiple Recognizers for a View: Redux     441

  Requiring Gesture Recognizer Failures     443

Custom UIGestureRecognizer Subclasses     444

Summary     445

Exercise     445

23  Accessing Photo Libraries     447

Sample App     447

The Assets Library     448

Enumerating Asset Groups and Assets     448

  Permissions     449

  Groups     451

  Assets     455

Displaying Assets     458

Saving to the Camera Roll     462

Dealing with Photo Stream     465

Summary      467

Exercises     467

24  Passbook and PassKit     469

The Sample App     470

Designing the Pass     470

  Pass Types     471

  Pass Layout—Boarding Pass     471

  Pass Layout—Coupon     471

  Pass Layout—Event     472

  Pass Layout—Generic     473

  Pass Layout—Store Card     474

  Pass Presentation     474

Building the Pass     476

  Basic Pass Identification     477

  Pass Relevance Information     478

  Barcode Identification     478

  Pass Visual Appearance Information     479

  Pass Fields     479

Signing and Packaging the Pass     482

  Creating the Pass Type ID     482

  Creating the Pass Signing Certificate     484

  Creating the Manifest     489

  Signing and Packaging the Pass     489

  Testing the Pass     490

  Interacting with Passes in an App     490

Updating Passes Automatically     501

Summary     502

Exercises     502

25  Debugging and Instruments     503

Introduction to Debugging     503

  The First Computer Bug     504

  Debugging Basics with Xcode     504

Breakpoints     506

  Customizing Breakpoints     507

  Symbolic and Exception Breakpoints     508

  Breakpoint Scope     508

Working with the Debugger     509

Instruments     511

  The Instruments Interface     512

  Exploring Instruments: The Time Profiler     514

  Exploring Instruments: Leaks     516

  Going Further with Instruments     519

Summary     519

Exercises     520

Index     521

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020