Product Cover Image

Advanced iOS 6 Developer's Cookbook, The, 4th Edition

By Erica Sadun

Published by Addison-Wesley Professional

Published Date: Mar 8, 2013

More Product Info

Description

The Advanced iOS 6 Developer’s Cookbook brings together reliable, proven solutions for cutting-edge iOS 6 development. World-renowned iOS expert Erica Sadun covers device-specific development, document/data sharing, Core Text, networking, image processing, onboard cameras, audio, Address Book, Core Location, GameKit,StoreKit, push notifications, and more.

As in her previous bestselling iOS books, Sadun translates today’s development best practices into working code, distilling key concepts into concise recipes that are easy to understand and transfer into your own projects. This isn’t just cut and paste. Using her examples, Sadun fully explains both the “how” and “why” of advanced and specialized iOS 6 development.

All code is tested with iOS 6 features and iPhone, iPad, and iPod touch capabilities. Throughout, every chapter groups related tasks together, so you can jump straight to your solution without having to identify the right class or framework first. Coverage includes

  • Testing device properties so your app can take full advantage of the iOS unit it’s running on
  • Seamlessly sharing documents and data across apps and moving control between apps
  • Presenting exceptionally attractive text with freeform text typesetting
  • Building touch-based apps that leverage Bezier curves, splines, and other geometric tools
  • Securing network apps via authentication, system keychains, and OAuth
  • Accessing and processing image data to create special effects
  • Integrating live camera feeds and user snapshots
  • Presenting audio to users and enabling them to interact with it
  • Effectively using Address Book frameworks and GUI classes
  • Building advanced location apps with Core Location geopositioning and MapKit
  • Creating connected game play with GameKit/Game Center: device-to-device networking, shared leaderboards, and Internet-based matches
  • Integrating secure in-app purchasing with StoreKit
  • Communicating with users from web-based services via push notifications

For related content by author Erica Sadun, see iOS Auto Layout Demystified, and The Core iOS 6 Cookbook.

Table of Contents

Preface     xiii

1 Device-Specific Development     1

Accessing Basic Device Information     1

Adding Device Capability Restrictions     2

Recipe: Checking Device Proximity and Battery States     5

Recipe: Recovering Additional Device Information     9

Recipe: Using Acceleration to Locate “Up”     11

Working with Basic Orientation     12

Retrieving the Current Accelerometer Angle Synchronously     13

Recipe: Using Acceleration to Move Onscreen Objects     16

Recipe: Accelerometer-Based Scroll View     19

Recipe: Core Motion Basics     21

Recipe: Retrieving and Using Device Attitude     26

Detecting Shakes Using Motion Events     27

Recipe: Using External Screens     29

Tracking Users     35

One More Thing: Checking for Available Disk Space     35

Summary     36

2 Documents and Data Sharing     39

Recipe: Working with Uniform Type Identifiers     39

Recipe: Accessing the System Pasteboard     45

Recipe: Monitoring the Documents Folder     48

Recipe: Presenting the Activity View Controller     54

Recipe: The Quick Look Preview Controller     63

Recipe: Adding a QuickLook Action     66

Recipe: Using The Document Interaction Controller     69

Recipe: Declaring Document Support     75

Recipe: Creating URL-Based Services     82

Summary     84

3 Core Text     87

Core Text and iOS     87

Attributed Strings     89

Recipe: Basic Attributed Strings     93

Recipe: Mutable Attributed Strings     95

The Mystery of Responder Styles     98

Recipe: Attribute Stacks     100

Recipe: Using Pseudo-HTML to Create Attributed Text     105

Drawing with Core Text     109

Creating Image Cut-Outs     112

Recipe: Drawing Core Text onto a Scroll View     114

Recipe: Exploring Fonts     116

Adding Custom Fonts to Your App     118

Recipe: Splitting Core Text into Pages     119

Recipe: Drawing Attributed Text into a PDF     120

Recipe: Big Phone Text     122

Summary     125

4 Geometry     127

Recipe: Retrieving Points from Bezier Paths     127

Recipe: Thinning Points     129

Recipe: Smoothing Drawings     132

Recipe: Velocity-Based Stroking     135

Recipe: Bounding Bezier Paths     137

Recipe: Fitting Paths     142

Working with Curves     144

Recipe: Moving Items Along a Bezier Path     148

Recipe: Drawing Attributed Text Along a Bezier Path     151

Recipe: View Transforms     154

Recipe: Testing for View Intersection     161

Summary     166

5 Networking     167

Recipe: Secure Credential Storage     167

Recipe: Entering Credentials     171

Recipe: Handling Authentication Challenges     176

Recipe: Uploading Data     177

Recipe: Building a Simple Web Server     181

Recipe: OAuth Utilities     184

Recipe: The OAuth Process     188

Summary     196

6 Images     197

Image Sources     197

Reading Image Data     199

Recipe: Fitting and Filling Images     203

Recipe: Rotating Images     208

Recipe: Working with Bitmap Representations     210

Recipe: Basic Image Processing     215

Recipe: Image Convolution     216

Recipe: Basic Core Image Processing     219

Capturing View-Based Screen Shots     221

Drawing into PDF Files     222

Recipe: Reflection     223

Recipe: Emitters     226

Summary     228

7 Cameras     229

Recipe: Snapping Photos     229

Recipe: Enabling a Flashlight     233

Recipe: Accessing the AVFoundation Camera     235

Recipe: EXIF     242

Image Orientations     247

Recipe: Core Image Filtering     249

Recipe: Core Image Face Detection     251

Recipe: Sampling a Live Feed     257

Summary     260

8 Audio     261

Recipe: Playing Audio with AVAudioPlayer     261

Recipe: Looping Audio     269

Recipe: Handling Audio Interruptions     272

Recipe: Recording Audio     274

Recipe: Recording Audio with Audio Queues     280

Recipe: Picking Audio with the MPMediaPickerController     286

Creating a Media Query     288

Recipe: Using the MPMusicPlayerController     290

Summary     294

9 Connecting to the Address Book     297

The AddressBook Frameworks     297

Recipe: Searching the Address Book     322

Recipe: Accessing Contact Image Data     325

Recipe: Picking People     326

Recipe: Limiting Contact Picker Properties     329

Recipe: Adding and Removing Contacts     331

Modifying and Viewing Individual Contacts     334

Recipe: The “Unknown” Person Controller     335

Summary     338

10 Location     339

Authorizing Core Location     339

Recipe: Core Location in a Nutshell     344

Recipe: Geofencing     348

Recipe: Keeping Track of “North” by Using Heading Values     350

Recipe: Forward and Reverse Geocoding     353

Recipe: Viewing a Location     355

Recipe: User Location Annotations     360

Recipe: Creating Map Annotations     363

Summary     369

11 GameKit     371

Enabling Game Center     371

Recipe: Signing In to Game Center     373

Designing Leaderboards and Achievements     375

Recipe: Accessing Leaderboards     378

Recipe: Displaying the Game Center View Controller     380

Recipe: Submitting Scores     381

Recipe: Checking Achievements     382

Recipe: Reporting Achievements to Game Center     383

Recipe: Multiplayer Matchmaking     385

Recipe: Responding to the Matchmaker     387

Recipe: Creating an Invitation Handler     388

Managing Match State     390

Recipe: Handling Player State Changes     390

Recipe: Retrieving Player Names     392

Game Play     393

Serializing Data     394

Recipe: Synchronizing Data     397

Recipe: Turn-by-Turn Matchmaking     399

Recipe: Responding to Turn-Based Invitations     401

Recipe: Loading Matches     402

Recipe: Responding to Game Play     403

Recipe: Ending Gameplay     407

Recipe: Removing Matches     410

Recipe: Game Center Voice     411

GameKit Peer Services     415

Summary     425

12 StoreKit     427

Getting Started with StoreKit     427

Creating Test Accounts     430

Creating New In-App Purchase Items     431

Building a Storefront GUI     435

Purchasing Items     438

Validating Receipts     443

Summary     445

13 Push Notifications     447

Introducing Push Notifications     447

Provisioning Push     451

Registering Your Application     454

Recipe: Push Client Skeleton     458

Building Notification Payloads     465

Recipe: Sending Notifications     466

Feedback Service     471

Designing for Push     473

Summary     473

Index     475

Purchase Info

ISBN-10: 0-13-312088-0

ISBN-13: 978-0-13-312088-2

Format: Safari PTG

This publication is not currently for sale.