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

Book description

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.

    Table of contents

    1. About This eBook
    2. Title Page
    3. Copyright Page
    4. Dedication Page
    5. Contents
    6. Foreword
    7. Preface
    8. Prerequisites
    9. What You’ll Need
    10. How This Book Is Organized
    11. About the Sample Code
    12. Getting the Sample Code
    13. Installing Git and Working with GitHub
    14. Contacting the Authors
    15. Acknowledgments
    16. About the Authors
    17. 1. UIKit Dynamics
      1. Sample App
      2. Introduction to UIKit Dynamics
      3. Implementing UIKit Dynamics
        1. Gravity
        2. Collisions
        3. Attachments
        4. Springs
        5. Snap
        6. Push Forces
        7. Item Properties
      4. In-Depth UIDynamicAnimator and UIDynamicAnimatorDelegate
      5. Summary
      6. Exercises
    18. 2. Core Location, MapKit, and Geofencing
      1. The Sample App
      2. Obtaining User Location
        1. Requirements and Permissions
        2. Checking for Services
        3. Starting Location Request
        4. Parsing and Understanding Location Data
        5. Significant Change Notifications
        6. Using GPX Files to Test Specific Locations
      3. Displaying Maps
        1. Understanding the Coordinate Systems
        2. MKMapKit Configuration and Customization
        3. Responding to User Interactions
      4. Map Annotations and Overlays
        1. Adding Annotations
        2. Displaying Standard and Custom Annotation Views
        3. Draggable Annotation Views
        4. Working with Map Overlays
      5. Geocoding and Reverse-Geocoding
        1. Geocoding an Address
        2. Reverse-Geocoding a Location
      6. Geofencing
        1. Checking for Regional Monitoring Capability
        2. Defining Boundaries
        3. Monitoring Changes
      7. Getting Directions
      8. Summary
      9. Exercises
    19. 3. Leaderboards
      1. Whack-a-Cac
        1. Spawning a Cactus
        2. Cactus Interaction
        3. Displaying Life and Score
        4. Pausing and Resuming
        5. Final Thoughts on Whack-a-Cac
      2. iTunes Connect
      3. Game Center Manager
      4. Authenticating
        1. Common Authentication Errors
        2. iOS 6 Authentication
      5. Submitting Scores
        1. Adding Scores to Whack-a-Cac
        2. Presenting Leaderboards
        3. Score Challenges
        4. Going Further with Leaderboards
      6. Summary
      7. Exercises
    20. 4. Achievements
      1. iTunes Connect
      2. Displaying Achievement Progress
      3. Game Center Manager and Authentication
      4. The Achievement Cache
      5. Reporting Achievements
      6. Adding Achievement Hooks
      7. Completion Banners
      8. Achievement Challenges
      9. Adding Achievements into Whack-a-Cac
        1. Earned or Unearned Achievements
        2. Partially Earned Achievements
        3. Multiple Session Achievements
        4. Piggybacked Achievements and Storing Achievement Precision
        5. Timer-Based Achievements
      10. Resetting Achievements
      11. Going Further with Achievements
      12. Summary
      13. Exercises
    21. 5. Getting Started with Address Book
      1. Why Address Book Support Is Important
      2. Limitations of Address Book Programming
      3. Introduction to the Sample App
      4. Getting Address Book Up and Running
        1. Reading Data from the Address Book
        2. Reading Multivalues from the Address Book
        3. Understanding Address Book Labels
        4. Working with Addresses
      5. Address Book Graphical User Interface
        1. People Picker
      6. Programmatically Creating Contacts
      7. Summary
      8. Exercises
    22. 6. Working with Music Libraries
      1. Introduction to the Sample App
      2. Building a Playback Engine
        1. Registering for Playback Notifications
        2. User Controls
        3. Handling State Changes
        4. Duration and Timers
        5. Shuffle and Repeat
      3. Media Picker
      4. Programmatic Picker
        1. Playing a Random Song
        2. Predicate Song Matching
      5. Summary
      6. Exercises
    23. 7. Working with and Parsing JSON
      1. JSON
        1. Benefits of Using JSON
        2. JSON Resources
      2. Sample App Overview
      3. Accessing the Server
      4. Getting JSON from the Server
        1. Building the Request
        2. Inspecting the Response
        3. Parsing JSON
        4. Displaying the Data
      5. Posting a Message
        1. Encoding JSON
        2. Sending JSON to the Server
      6. Summary
      7. Exercise
    24. 8. Getting Started with iCloud
      1. The Sample App
      2. Setting Up the App for iCloud Support
        1. Account Setup
        2. Enabling iCloud Capabilities
        3. Initializing iCloud
      3. Introducing UIDocument
        1. Subclassing UIDocument
        2. Interacting with UIDocument
      4. Interacting with iCloud
        1. Listing Documents in iCloud
        2. Detecting Conflicts in iCloud
      5. Conflict Resolution
      6. Key-Value Store Syncing
      7. Summary
      8. Exercises
    25. 9. Notifications
      1. Differences Between Local and Push Notifications
      2. Sample App
      3. App Setup
      4. Create Development Push SSL Certificate
      5. Development Provisioning Profile
      6. Custom Sound Preparation
      7. Registering for Remote Notifications
      8. Scheduling Local Notifications
      9. Receiving Notifications
      10. Push Notification Server
      11. Basic Rails Setup
      12. Add Support for Devices and Shouts
      13. Device Controller
      14. Shout Controller
      15. Tying It All Together
      16. Sending the Push Notifications
      17. Handling APNs Feedback
      18. Summary
      19. Exercise
    26. 10. Bluetooth Networking with Game Kit
      1. Limitations of Game Kit’s Bluetooth Networking
      2. Benefits of Game Kit’s Bluetooth Networking
      3. Sample App
      4. The Peer Picker
      5. Sending Data
        1. Data Modes
        2. Sending Data in the Sample App
      6. Receiving Data
        1. Receiving Data in the Sample App
      7. State Changes
      8. Advanced Features
        1. Peer Display Name
        2. Connecting Without the Peer Picker
        3. Session Modes
      9. Summary
      10. Exercises
    27. 11. AirPrint
      1. AirPrint Printers
      2. Testing for AirPrint
      3. Printing Text
        1. Print Info
        2. Setting Page Range
        3. Error Handling
        4. Starting the Print Job
        5. Print Simulator Feedback
      4. Print Center
        1. UIPrintInteractionControllerDelegate
      5. Printing Rendered HTML
      6. Printing PDFs
      7. Summary
      8. Exercises
    28. 12. Core Data Primer
      1. Deciding on Core Data
      2. Core Data Managed Objects
        1. Managed Objects
        2. Managed Object Model
        3. Managed Object Model Migrations
        4. Creating Managed Objects
        5. Fetching and Sorting Objects
        6. Fetched Results Controller
      3. The Core Data Environment
        1. Persistent Store Coordinator
        2. Persistent Store
        3. Managed Object Context
      4. Summary
    29. 13. Getting Up and Running with Core Data
      1. Sample App
      2. Starting a Core Data Project
        1. Core Data Environment
      3. Building Your Managed Object Model
        1. Creating an Entity
        2. Adding Attributes
        3. Establishing Relationships
        4. Custom Managed Object Subclasses
      4. Setting Up Default Data
        1. Inserting New Managed Objects
        2. Other Default Data Setup Techniques
      5. Displaying Your Managed Objects
        1. Creating Your Fetch Request
        2. Fetching by Object ID
        3. Displaying Your Object Data
        4. Using Predicates
      6. Introducing the Fetched Results Controller
        1. Preparing the Fetched Results Controller
        2. Integrating Table View and Fetched Results Controller
        3. Responding to Core Data Changes
      7. Adding, Editing, and Removing Managed Objects
        1. Inserting a New Managed Object
        2. Removing a Managed Object
        3. Editing an Existing Managed Object
        4. Saving and Rolling Back Your Changes
      8. Summary
      9. Exercises
    30. 14. Language Features
      1. Literals
        1. NSNumber
        2. NSArray
        3. NSDictionary
        4. Boxed Expressions
      2. Automatic Reference Counting
        1. Using ARC in a New Project
        2. Converting an Existing Project to ARC
        3. Basic ARC Usage
        4. ARC Qualifiers
      3. Blocks
        1. Declaring and Using Blocks
        2. Capturing State with Blocks
        3. Using Blocks as Method Parameters
        4. Memory, Threads, and Blocks
      4. Properties
        1. Declaring Properties
        2. Synthesizing Properties
        3. Accessing Properties
        4. Dot Notation
        5. Fast Enumeration
      5. Method Swizzling
      6. Summary
      7. Exercises
    31. 15. Integrating Twitter and Facebook Using Social Framework
      1. Social Integration
      2. The Sample App
      3. Logging In
      4. Using SLComposeViewController
      5. Posting with a Custom Interface
        1. Posting to Twitter
        2. Posting to Facebook
        3. Creating a Facebook App
      6. Accessing User Timelines
        1. Twitter
        2. Facebook
      7. Summary
      8. Exercises
    32. 16. Working with Background Tasks
      1. The Sample App
      2. Checking for Background Availability
      3. Finishing a Task in the Background
        1. Background Task Identifier
        2. Expiration Handler
        3. Completing the Background Task
      4. Implementing Background Activities
        1. Types of Background Activities
        2. Playing Music in the Background
      5. Summary
      6. Exercises
    33. 17. Grand Central Dispatch for Performance
      1. The Sample App
      2. Introduction to Queues
      3. Running on the Main Thread
      4. Running in the Background
      5. Running in an Operation Queue
        1. Concurrent Operations
        2. Serial Operations
        3. Canceling Operations
        4. Custom Operations
      6. Running in a Dispatch Queue
        1. Concurrent Dispatch Queues
        2. Serial Dispatch Queues
      7. Summary
      8. Exercises
    34. 18. Using Keychain to Secure Data
      1. Introduction to the Sample App
      2. Setting Up and Using Keychain
        1. Setting Up a New KeychainItemWrapper
        2. Storing and Retrieving the PIN
        3. Keychain Attribute Keys
        4. Securing a Dictionary
        5. Resetting a Keychain Item
        6. Sharing a Keychain Between Apps
        7. Keychain Error Codes
      3. Summary
      4. Exercises
    35. 19. Working with Images and Filters
      1. The Sample App
      2. Basic Image Data and Display
        1. Instantiating an Image
        2. Displaying an Image
        3. Using the Image Picker
        4. Resizing an Image
      3. Core Image Filters
        1. Filter Categories and Filters
        2. Filter Attributes
        3. Initializing an Image
        4. Rendering a Filtered Image
        5. Chaining Filters
      4. Face Detection
        1. Setting Up a Face Detector
        2. Processing Face Features
      5. Summary
      6. Exercises
    36. 20. Collection Views
      1. The Sample App
      2. Introducing Collection Views
        1. Setting Up a Collection View
        2. Implementing the Collection View Data Source Methods
        3. Implementing the Collection View Delegate Methods
      3. Customizing Collection View and Flow Layout
        1. Basic Customizations
        2. Decoration Views
      4. Creating Custom Layouts
      5. Collection View Animations
        1. Collection View Layout Changes
        2. Collection View Layout Animations
        3. Collection View Change Animations
      6. Summary
      7. Exercises
    37. 21. Introduction to TextKit
      1. Sample App
      2. Introducing NSLayoutManager
        1. NSTextStore
      3. Detecting Links Dynamically
      4. Detecting Hits
      5. Exclusion Paths
      6. Content Specific Highlighting
      7. Changing Font Settings with Dynamic Type
      8. Summary
      9. Exercises
    38. 22. Gesture Recognizers
      1. Types of Gesture Recognizers
      2. Basic Gesture Recognizer Usage
      3. Introduction to the Sample App
        1. Tap Recognizer in Action
        2. Pinch Recognizer in Action
      4. Multiple Recognizers for a View
        1. Gesture Recognizers: Under the Hood
        2. Multiple Recognizers for a View: Redux
        3. Requiring Gesture Recognizer Failures
      5. Custom UIGestureRecognizer Subclasses
      6. Summary
      7. Exercise
    39. 23. Accessing Photo Libraries
      1. Sample App
      2. The Assets Library
      3. Enumerating Asset Groups and Assets
        1. Permissions
        2. Groups
        3. Assets
      4. Displaying Assets
      5. Saving to the Camera Roll
      6. Dealing with Photo Stream
      7. Summary
      8. Exercises
    40. 24. Passbook and PassKit
      1. The Sample App
      2. Designing the Pass
        1. Pass Types
        2. Pass Layout—Boarding Pass
        3. Pass Layout—Coupon
        4. Pass Layout—Event
        5. Pass Layout—Generic
        6. Pass Layout—Store Card
        7. Pass Presentation
      3. Building the Pass
        1. Basic Pass Identification
        2. Pass Relevance Information
        3. Barcode Identification
        4. Pass Visual Appearance Information
        5. Pass Fields
      4. Signing and Packaging the Pass
        1. Creating the Pass Type ID
        2. Creating the Pass Signing Certificate
        3. Creating the Manifest
        4. Signing and Packaging the Pass
        5. Testing the Pass
        6. Interacting with Passes in an App
      5. Updating Passes Automatically
      6. Summary
      7. Exercises
    41. 25. Debugging and Instruments
      1. Introduction to Debugging
        1. The First Computer Bug
        2. Debugging Basics with Xcode
      2. Breakpoints
        1. Customizing Breakpoints
        2. Symbolic and Exception Breakpoints
        3. Breakpoint Scope
      3. Working with the Debugger
      4. Instruments
        1. The Instruments Interface
        2. Exploring Instruments: The Time Profiler
        3. Exploring Instruments: Leaks
        4. Going Further with Instruments
      5. Summary
      6. Exercises
    42. Index

    Product information

    • Title: iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK
    • Author(s):
    • Release date: November 2013
    • Publisher(s): Addison-Wesley Professional
    • ISBN: 9780133086898