0%

Apple’s iOS SDK provides an amazingly powerful collection of frameworks. But it has been difficult to find detailed and useful knowledge about them–until now. With this book’s practical insights and tested code, you can use Apple’s frameworks to create apps that are more innovative and usable…faster and more reliable…more successful and profitable.


Kyle Richter and Joe Keeley focus on intermediate-to-advanced techniques that professional iOS developers can use every day. Their far-reaching coverage ranges from social support to security, Core Data to iCloud–even Apple Watch.


Organized as a convenient modular reference, nearly every chapter contains a complete Objective-C sample project. A multi-chapter Game Center case study shows how multiple iOS features can be combined to do even more.

All source code may be downloaded athttps://github.com/dfsw/icf.

Coverage includes:

  • Adding physics-like animation and behaviors to UIViews

  • Using Core Location to determine device location, display customized maps, and implement geofencing

  • Making games and apps social with Leaderboards

  • Accessing music and image collections

  • Building health/fitness apps with HealthKit

  • Integrating with home automation via HomeKit

  • Passing data between platforms using JSON

  • Setting up local and remote notifications

  • Remotely storing and syncing data with CloudKit

  • Accessing app functionality with extensions

  • Effortlessly adding AirPrint support

  • Providing Handoff continuity between iOS 8 and Yosemite devices

  • Getting productive with Core Data

  • Integrating Twitter and Facebook via Social Framework

  • Performing resource-intensive tasks with Grand Central Dispatch

  • Securing user data with Keychain and Touch ID

  • Customizing collection views

  • Making the most of gesture recognizers

  • Creating and distributing “passes”

  • Debugging, instrumenting, and profiling apps

  • Table of Contents

    1. About This eBook
    2. Title Page
    3. Copyright Page
    4. Dedication Page
    5. Table of Contents
    6. Foreword
    7. Preface
      1. Prerequisites
      2. What You’ll Need
      3. How This Book Is Organized
      4. About the Sample Code
      5. Getting the Sample Code
      6. Installing Git and Working with GitHub
      7. Contacting the Authors
    8. Acknowledgments
    9. About the Authors
    10. 1. UIKit Dynamics
      1. The Sample App
      2. Introduction to UIKit Dynamics
      3. Implementing UIKit Dynamics
      4. Gravity
      5. Collisions
      6. Attachments
      7. Springs
      8. Snap
      9. Push Forces
      10. Item Properties
      11. In-Depth UIDynamicAnimator and UIDynamicAnimatorDelegate
      12. Summary
    11. 2. Core Location, MapKit, and Geofencing
      1. The Sample App
      2. Obtaining User Location
      3. Requirements and Permissions
      4. Checking for Services
      5. Starting Location Request
      6. Parsing and Understanding Location Data
      7. Significant Change Notifications
      8. Using GPX Files to Test Specific Locations
      9. Displaying Maps
      10. Understanding the Coordinate Systems
      11. MKMapKit Configuration and Customization
      12. Responding to User Interactions
      13. Map Annotations and Overlays
      14. Adding Annotations
      15. Displaying Standard and Custom Annotation Views
      16. Draggable Annotation Views
      17. Working with Map Overlays
      18. Geocoding and Reverse-Geocoding
      19. Geocoding an Address
      20. Reverse-Geocoding a Location
      21. Geofencing
      22. Checking for Regional Monitoring Capability
      23. Defining Boundaries
      24. Monitoring Changes
      25. Getting Directions
      26. Summary
    12. 3. Leaderboards
      1. The Sample App
      2. Spawning a Cactus
      3. Cactus Interaction
      4. Displaying Life and Score
      5. Pausing and Resuming
      6. Final Thoughts on Whack-a-Cac
      7. iTunes Connect
      8. Game Center Manager
      9. Authenticating
      10. Common Authentication Errors
      11. iOS 6 and Newer Authentication
      12. Submitting Scores
      13. Adding Scores to Whack-a-Cac
      14. Presenting Leaderboards
      15. Score Challenges
      16. Going Further with Leaderboards
      17. Summary
    13. 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
      10. Earned or Unearned Achievements
      11. Partially Earned Achievements
      12. Multiple Session Achievements
      13. Piggybacked Achievements and Storing Achievement Precision
      14. Timer-Based Achievements
      15. Resetting Achievements
      16. Going Further with Achievements
      17. Summary
    14. 5. Getting Started with Address Book
      1. Why Address Book Support Is Important
      2. Limitations of Address Book Programming
      3. The Sample App
      4. Getting Address Book Up and Running
      5. Reading Data from the Address Book
      6. Reading Multivalues from the Address Book
      7. Understanding Address Book Labels
      8. Working with Addresses
      9. Address Book Graphical User Interface
      10. People Picker
      11. Programmatically Creating Contacts
      12. Summary
    15. 6. Working with Music Libraries
      1. The Sample App
      2. Building a Playback Engine
      3. Registering for Playback Notifications
      4. User Controls
      5. Handling State Changes
      6. Duration and Timers
      7. Shuffle and Repeat
      8. Media Picker
      9. Programmatic Picker
      10. Playing a Random Song
      11. Predicate Song Matching
      12. Summary
    16. 7. Implementing HealthKit
      1. Introduction to HealthKit
      2. Introduction to Health.app
      3. The Sample App
      4. Adding HealthKit to a Project
      5. Requesting Permission for Health Data
      6. Reading Characteristic HealthKit Data
      7. Reading and Writing Basic HealthKit Data
      8. Reading and Writing Complex HealthKit Data
      9. Summary
    17. 8. Implementing HomeKit
      1. The Sample App
      2. Introduction to HomeKit
      3. Setting Up HomeKit Components
      4. Developer Account Setup
      5. Enabling HomeKit Capability
      6. Home Manager
      7. Home
      8. Rooms and Zones
      9. Accessories
      10. Services and Service Groups
      11. Actions and Action Sets
      12. Testing with the HomeKit Accessory Simulator
      13. Scheduling Actions with Triggers
      14. Summary
    18. 9. Working with and Parsing JSON
      1. JSON
      2. Benefits of Using JSON
      3. JSON Resources
      4. The Sample App
      5. Accessing the Server
      6. Getting JSON from the Server
      7. Building the Request
      8. Inspecting the Response
      9. Parsing JSON
      10. Displaying the Data
      11. Posting a Message
      12. Encoding JSON
      13. Sending JSON to the Server
      14. Summary
    19. 10. Notifications
      1. Differences Between Local and Push Notifications
      2. The Sample App
      3. App Setup
      4. Creating Development Push SSL Certificate
      5. Development Provisioning Profile
      6. Custom Sound Preparation
      7. Registering for Notifications
      8. Scheduling Local Notifications
      9. Receiving Notifications
      10. Push Notification Server
      11. Sending the Push Notifications
      12. Handling APNs Feedback
      13. Summary
    20. 11. Cloud Persistence with CloudKit
      1. CloudKit Basics
      2. The Sample App
      3. Setting Up a CloudKit Project
      4. Account Setup
      5. Enabling iCloud Capabilities
      6. CloudKit Concepts
      7. Containers
      8. Databases
      9. Records
      10. Record Zones
      11. Record Identifiers
      12. Assets
      13. CloudKit Basic Operations
      14. Fetching Records
      15. Create and Save a Record
      16. Update and Save a Record
      17. Subscriptions and Push
      18. Push Setup
      19. Subscribing to Data Changes
      20. User Discovery and Management
      21. Managing Data in the Dashboard
      22. Summary
    21. 12. Extensions
      1. Types of Extensions
      2. Today
      3. Share
      4. Action
      5. Photo Editing
      6. Document Provider
      7. Custom Keyboard
      8. Understanding Extensions
      9. API Limitations
      10. Creating Extensions
      11. Today Extension
      12. Sharing Code and Information between Host App and Extension
      13. Apple Watch Extension
      14. Summary
    22. 13. Handoff
      1. The Sample App
      2. Handoff Basics
      3. Implementing Handoff
      4. Creating the User Activity
      5. Continuing an Activity
      6. Implementing Handoff in Document-Based Apps
      7. Summary
    23. 14. AirPrint
      1. AirPrint Printers
      2. Testing for AirPrint
      3. Printing Text
      4. Print Info
      5. Setting Page Range
      6. UISimpleTextPrintFormatter
      7. Error Handling
      8. Starting the Print Job
      9. Printer Simulator Feedback
      10. Print Center
      11. UIPrintInteractionControllerDelegate
      12. Printing Rendered HTML
      13. Printing PDFs
      14. Summary
    24. 15. Getting Up and Running with Core Data
      1. Deciding on Core Data
      2. Sample App
      3. Starting a Core Data Project
      4. Core Data Environment
      5. Building Your Managed Object Model
      6. Creating an Entity
      7. Adding Attributes
      8. Establishing Relationships
      9. Custom Managed Object Subclasses
      10. Setting Up Default Data
      11. Inserting New Managed Objects
      12. Other Default Data Setup Techniques
      13. Displaying Your Managed Objects
      14. Creating Your Fetch Request
      15. Fetching by Object ID
      16. Displaying Your Object Data
      17. Using Predicates
      18. Introducing the Fetched Results Controller
      19. Preparing the Fetched Results Controller
      20. Integrating Table View and Fetched Results Controller
      21. Responding to Core Data Changes
      22. Adding, Editing, and Removing Managed Objects
      23. Inserting a New Managed Object
      24. Removing a Managed Object
      25. Editing an Existing Managed Object
      26. Saving and Rolling Back Your Changes
      27. Summary
    25. 16. Integrating Twitter and Facebook Using Social Framework
      1. The Sample App
      2. Logging In
      3. Using SLComposeViewController
      4. Posting with a Custom Interface
      5. Posting to Twitter
      6. Posting to Facebook
      7. Creating a Facebook App
      8. Accessing User Timelines
      9. Twitter
      10. Facebook
      11. Summary
    26. 17. Working with Background Tasks
      1. The Sample App
      2. Checking for Background Availability
      3. Finishing a Task in the Background
      4. Background Task Identifier
      5. Expiration Handler
      6. Completing the Background Task
      7. Implementing Background Activities
      8. Types of Background Activities
      9. Playing Music in the Background
      10. Summary
    27. 18. 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
      6. Concurrent Operations
      7. Serial Operations
      8. Canceling Operations
      9. Custom Operations
      10. Running in a Dispatch Queue
      11. Concurrent Dispatch Queues
      12. Serial Dispatch Queues
      13. Summary
    28. 19. Using Keychain and Touch ID to Secure and Access Data
      1. The Sample App
      2. Setting Up and Using Keychain
      3. Setting Up a New KeychainItemWrapper
      4. Storing and Retrieving the PIN
      5. Keychain Attribute Keys
      6. Securing a Dictionary
      7. Resetting a Keychain Item
      8. Sharing a Keychain Between Apps
      9. Keychain Error Codes
      10. Implementing Touch ID
      11. Summary
    29. 20. Working with Images and Filters
      1. The Sample App
      2. Basic Image Data and Display
      3. Instantiating an Image
      4. Displaying an Image
      5. Using the Image Picker
      6. Resizing an Image
      7. Core Image Filters
      8. Filter Categories and Filters
      9. Filter Attributes
      10. Initializing an Image
      11. Rendering a Filtered Image
      12. Chaining Filters
      13. Feature Detection
      14. Setting Up a Face Detector
      15. Processing Face Features
      16. Summary
    30. 21. Collection Views
      1. The Sample App
      2. Introducing Collection Views
      3. Setting Up a Collection View
      4. Implementing the Collection View Data Source Methods
      5. Implementing the Collection View Delegate Methods
      6. Customizing Collection View and Flow Layout
      7. Basic Customizations
      8. Decoration Views
      9. Creating Custom Layouts
      10. Collection View Animations
      11. Collection View Layout Changes
      12. Collection View Layout Animations
      13. Collection View Change Animations
      14. Summary
    31. 22. Introduction to TextKit
      1. The Sample App
      2. Introducing NSLayoutManager
      3. Detecting Links Dynamically
      4. Detecting Hits
      5. Exclusion Paths
      6. Content Specific Highlighting
      7. Changing Font Settings with Dynamic Type
      8. Summary
    32. 23. Gesture Recognizers
      1. Types of Gesture Recognizers
      2. Basic Gesture Recognizer Usage
      3. Introduction to the Sample App
      4. Tap Recognizer in Action
      5. Pinch Recognizer in Action
      6. Multiple Recognizers for a View
      7. Gesture Recognizers: Under the Hood
      8. Multiple Recognizers for a View: Redux
      9. Requiring Gesture Recognizer Failures
      10. Custom UIGestureRecognizer Subclasses
      11. Summary
    33. 24. Accessing the Photo Library
      1. The Sample App
      2. The Photos Framework
      3. Using Asset Collections and Assets
      4. Permissions
      5. Asset Collections
      6. Assets
      7. Changes in the Photo Library
      8. Asset Collection Changes
      9. Asset Changes
      10. Dealing with Photo Stream
      11. Summary
    34. 25. Passbook and PassKit
      1. The Sample App
      2. Designing the Pass
      3. Pass Types
      4. Pass Layout—Boarding Pass
      5. Pass Layout—Coupon
      6. Pass Layout—Event
      7. Pass Layout—Generic
      8. Pass Layout—Store Card
      9. Pass Presentation
      10. Building the Pass
      11. Basic Pass Identification
      12. Pass Relevance Information
      13. Barcode Identification
      14. Pass Visual Appearance Information
      15. Pass Fields
      16. Signing and Packaging the Pass
      17. Creating the Pass Type ID
      18. Creating the Pass Signing Certificate
      19. Creating the Manifest
      20. Signing and Packaging the Pass
      21. Testing the Pass
      22. Interacting with Passes in an App
      23. Updating Passes Automatically
      24. Summary
    35. 26. Debugging and Instruments
      1. Introduction to Debugging
      2. The First Computer Bug
      3. Debugging Basics with Xcode
      4. Breakpoints
      5. Customizing Breakpoints
      6. Symbolic and Exception Breakpoints
      7. Breakpoint Scope
      8. Working with the Debugger
      9. Instruments
      10. The Instruments Interface
      11. Exploring Instruments: The Time Profiler
      12. Exploring Instruments: Leaks
      13. Going Further with Instruments
      14. Summary
    36. Index
    37. Code Snippets
    3.236.19.251