You are previewing The Advanced iOS 6 Developer’s Cookbook, Fourth Edition.
O'Reilly logo
The Advanced iOS 6 Developer’s Cookbook, Fourth Edition

Book 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

  1. Title Page
  2. Copyright Page
  3. Dedication Page
  4. Contents at a Glance
  5. Table of Contents
  6. Acknowledgments
  7. About the Author
  8. Preface
    1. What You Need
    2. Your Roadmap to Mac/iOS Development
    3. How This Book Is Organized
    4. About the Sample Code
    5. Getting the Sample Code
    6. Contribute!
    7. Getting Git
    8. Getting GitHub
    9. Contacting the Author
    10. Endnotes
  9. Editor’s Note: We Want to Hear from You!
  10. 1. Device-Specific Development
    1. Accessing Basic Device Information
    2. Adding Device Capability Restrictions
    3. Recipe: Checking Device Proximity and Battery States
    4. Recipe: Recovering Additional Device Information
    5. Recipe: Using Acceleration to Locate “Up”
    6. Working with Basic Orientation
    7. Retrieving the Current Accelerometer Angle Synchronously
    8. Recipe: Using Acceleration to Move Onscreen Objects
    9. Recipe: Accelerometer-Based Scroll View
    10. Recipe: Core Motion Basics
    11. Recipe: Retrieving and Using Device Attitude
    12. Detecting Shakes Using Motion Events
    13. Recipe: Using External Screens
    14. Tracking Users
    15. One More Thing: Checking for Available Disk Space
    16. Summary
  11. 2. Documents and Data Sharing
    1. Recipe: Working with Uniform Type Identifiers
    2. Recipe: Accessing the System Pasteboard
    3. Recipe: Monitoring the Documents Folder
    4. Recipe: Presenting the Activity View Controller
    5. Recipe: The Quick Look Preview Controller
    6. Recipe: Adding a QuickLook Action
    7. Recipe: Using The Document Interaction Controller
    8. Recipe: Declaring Document Support
    9. Recipe: Creating URL-Based Services
    10. Summary
  12. 3. Core Text
    1. Core Text and iOS
    2. Attributed Strings
    3. Recipe: Basic Attributed Strings
    4. Recipe: Mutable Attributed Strings
    5. The Mystery of Responder Styles
    6. Recipe: Attribute Stacks
    7. Recipe: Using Pseudo-HTML to Create Attributed Text
    8. Drawing with Core Text
    9. Creating Image Cut-Outs
    10. Recipe: Drawing Core Text onto a Scroll View
    11. Recipe: Exploring Fonts
    12. Adding Custom Fonts to Your App
    13. Recipe: Splitting Core Text into Pages
    14. Recipe: Drawing Attributed Text into a PDF
    15. Recipe: Big Phone Text
    16. Summary
  13. 4. Geometry
    1. Recipe: Retrieving Points from Bezier Paths
    2. Recipe: Thinning Points
    3. Recipe: Smoothing Drawings
    4. Recipe: Velocity-Based Stroking
    5. Recipe: Bounding Bezier Paths
    6. Recipe: Fitting Paths
    7. Working with Curves
    8. Recipe: Moving Items Along a Bezier Path
    9. Recipe: Drawing Attributed Text Along a Bezier Path
    10. Recipe: View Transforms
    11. Recipe: Testing for View Intersection
    12. Summary
  14. 5. Networking
    1. Recipe: Secure Credential Storage
    2. Recipe: Entering Credentials
    3. Recipe: Handling Authentication Challenges
    4. Recipe: Uploading Data
    5. Recipe: Building a Simple Web Server
    6. Recipe: OAuth Utilities
    7. Recipe: The OAuth Process
    8. Summary
  15. 6. Images
    1. Image Sources
    2. Reading Image Data
    3. Recipe: Fitting and Filling Images
    4. Recipe: Rotating Images
    5. Recipe: Working with Bitmap Representations
    6. Recipe: Basic Image Processing
    7. Recipe: Image Convolution
    8. Recipe: Basic Core Image Processing
    9. Capturing View-Based Screen Shots
    10. Drawing into PDF Files
    11. Recipe: Reflection
    12. Recipe: Emitters
    13. Summary
  16. 7. Cameras
    1. Recipe: Snapping Photos
    2. Recipe: Enabling a Flashlight
    3. Recipe: Accessing the AVFoundation Camera
    4. Recipe: EXIF
    5. Image Orientations
    6. Recipe: Core Image Filtering
    7. Recipe: Core Image Face Detection
    8. Recipe: Sampling a Live Feed
    9. Summary
  17. 8. Audio
    1. Recipe: Playing Audio with AVAudioPlayer
    2. Recipe: Looping Audio
    3. Recipe: Handling Audio Interruptions
    4. Recipe: Recording Audio
    5. Recipe: Recording Audio with Audio Queues
    6. Recipe: Picking Audio with the MPMediaPickerController
    7. Creating a Media Query
    8. Recipe: Using the MPMusicPlayerController
    9. Summary
  18. 9. Connecting to the Address Book
    1. The AddressBook Frameworks
    2. Recipe: Searching the Address Book
    3. Recipe: Accessing Contact Image Data
    4. Recipe: Picking People
    5. Recipe: Limiting Contact Picker Properties
    6. Recipe: Adding and Removing Contacts
    7. Modifying and Viewing Individual Contacts
    8. Recipe: The “Unknown” Person Controller
    9. Summary
  19. 10. Location
    1. Authorizing Core Location
    2. Recipe: Core Location in a Nutshell
    3. Recipe: Geofencing
    4. Recipe: Keeping Track of “North” by Using Heading Values
    5. Recipe: Forward and Reverse Geocoding
    6. Recipe: Viewing a Location
    7. Recipe: User Location Annotations
    8. Recipe: Creating Map Annotations
    9. Summary
  20. 11. GameKit
    1. Enabling Game Center
    2. Recipe: Signing In to Game Center
    3. Designing Leaderboards and Achievements
    4. Recipe: Accessing Leaderboards
    5. Recipe: Displaying the Game Center View Controller
    6. Recipe: Submitting Scores
    7. Recipe: Checking Achievements
    8. Recipe: Reporting Achievements to Game Center
    9. Recipe: Multiplayer Matchmaking
    10. Recipe: Responding to the Matchmaker
    11. Recipe: Creating an Invitation Handler
    12. Managing Match State
    13. Recipe: Handling Player State Changes
    14. Recipe: Retrieving Player Names
    15. Game Play
    16. Serializing Data
    17. Recipe: Synchronizing Data
    18. Recipe: Turn-by-Turn Matchmaking
    19. Recipe: Responding to Turn-Based Invitations
    20. Recipe: Loading Matches
    21. Recipe: Responding to Game Play
    22. Recipe: Ending Gameplay
    23. Recipe: Removing Matches
    24. Recipe: Game Center Voice
    25. GameKit Peer Services
    26. Summary
  21. 12. StoreKit
    1. Getting Started with StoreKit
    2. Creating Test Accounts
    3. Creating New In-App Purchase Items
    4. Building a Storefront GUI
    5. Purchasing Items
    6. Validating Receipts
    7. Summary
  22. 13. Push Notifications
    1. Introducing Push Notifications
    2. Provisioning Push
    3. Registering Your Application
    4. Recipe: Push Client Skeleton
    5. Building Notification Payloads
    6. Recipe: Sending Notifications
    7. Feedback Service
    8. Designing for Push
    9. Summary
  23. Index