Learning iCloud Data Management: A Hands-On Guide to Structuring Data for iOS and OS X

Book description

“A great read for iOS developers who want to learn if iCloud is right for their app and dive right in with lots of practical code examples.”
—Jon Bell, UXLaunchpad.com

Get Hands-On Mastery of iCloud Data Management for iOS 7 and OS X Mavericks

As apps rapidly move into business and the cloud, iOS and OS X developers need new data management techniques. In Learning iCloud Data Management, renowned Apple database expert Jesse Feiler shows you how to use Apple’s latest APIs and technologies to structure and synchronize all forms of data. Feiler helps you understand the issues, implement efficient solutions, and deliver highly usable apps that seamlessly synchronize during the “Round Trip” between iOS and OS X and back again.

This guide walks you through integrating several key Apple data management technologies, including the Address Book and Calendar APIs. Feiler shows you how to structure data so it’s easy to build great Cocoa and Cocoa Touch user interfaces and to quickly incorporate reliable iCloud syncing. Step by step, you’ll discover how to blend Apple’s standard application data structures with your own user data to create a feature-rich and fully syncable environment.

Coverage includes

  • Understanding iCloud from the developer’s and user’s point of view

  • Accessing synchronized user calendars and contacts

  • Integrating Reminders into your apps

  • Playing by iCloud’s user privacy rules

  • Applying consistent iOS Settings and OS X Preferences across user devices

  • Managing persistent storage with Core Data

  • Using Xcode Project Workspaces for shared development

  • Adding data to app bundles and resources

  • Integrating iCloud infrastructure, file wrappers, documents, and data

  • Completing the”Round Trip” between both iOS and OS X

  • Table of contents

    1. About This eBook
    2. Title Page
    3. Copyright Page
    4. Contents at a Glance
    5. Contents
    6. Preface
      1. Who Should Read This Book
      2. Downloading the Example Files
      3. How This Book Is Organized
        1. Part I: Introducing iCloud
        2. Part II: Using the APIs
        3. Part III: Using the Technologies
        4. Part IV: Using iCloud Documents and Data
    7. Acknowledgments
    8. About the Author
    9. We Want to Hear from You!
      1. Reader Services
    10. Introduction
    11. I: Introducing iCloud
      1. 1. Exploring iCloud and Its User Experience
        1. Looking at Cloud Computing
        2. Understanding the iCloud Paradigm
          1. Organizing Files by App
          2. Managing Documents with iCloud, Time Machine, and Auto Save
          3. Syncing Data Across Devices
        3. Making the Round Trip
        4. Chapter Summary
        5. Exercises
      2. 2. Setting Up iCloud for Development
        1. Managing App Security on iOS and OS X
          1. Identifying Yourself and Your App on developer.apple.com
          2. Identifying Your User and Your Ubiquity Container at Runtime
        2. Looking Inside the iCloud Basics
          1. Apple ID
          2. Bundle Identifier
          3. Entitlements and Capabilities
          4. Ubiquity Container
        3. Using iCloud in Your App
        4. Chapter Summary
        5. Exercises
    12. II: Using the APIs
      1. 3. Introducing the APIs and the First Apps
        1. Getting Started as an Apple Developer
        2. Looking at the APIs
        3. Introducing the Built-In Data Apps
          1. Keeping Up with Apple
          2. App Overview
          3. Creating Separate Xcode Projects for iOS and OS X
        4. Wiring Up the Interfaces
          1. Wiring Up the iOS Interface
          2. Wiring Up the OS X Interfaces
        5. Chapter Summary
        6. Exercises
      2. 4. Working with the AddressBook API for Contacts
        1. Considering the AddressBook API on iOS and OS X
        2. Sending Mail from the iOS App
          1. Making Sure You Can Send Mail
          2. Sending the Message
          3. Checking That Mail Is Configured and the Internet Is Available
        3. Sending Mail from the OS X App
        4. Using Property Lists for Storing and Syncing
        5. Chapter Summary
        6. Exercises
      3. 5. Managing Calendars and Reminders with the Event Kit API
        1. Exploring the Event Class Hierarchy
        2. Setting OS X Permissions
        3. Working with the Calendar Database
          1. Allocating and Getting Access to the Event Store
          2. Creating a New Event or Reminder
          3. Searching for an Event or Reminder
          4. Setting or Modifying Properties
          5. Committing Changes
        4. Adding a Reminder to the App on iOS
        5. Adding an Event to the App on OS X
        6. Chapter Summary
        7. Exercises
      4. 6. Protecting the Privacy of User Data
        1. The Need for Privacy
        2. Looking at Apple’s Rules and Guidelines
        3. Best Practices in App Privacy
          1. Know What Should Be Private
          2. Use Good Programming Style to Enforce Privacy
          3. Be Careful When Debugging
          4. Ask Permission and Explain What You’ll Do with the Data
          5. Do Not Require Personal Data to Unlock Your App
          6. Add Extra Measures to Protect Minors
          7. Provide Privacy for Support Materials
          8. Consider User Issues
        4. Chapter Summary
        5. Exercises
    13. III: Using the Technologies
      1. 7. Introducing Blocks, Threads, and Notifications
        1. Catching Up with Blocks and Threads
          1. Queues and Threads
          2. Blocks
        2. Getting Up to Speed with Notifications
          1. Notification Properties
          2. Registering for Notifications
          3. Posting Notifications
        3. Receiving Notification of iCloud Availability Changes
        4. Introducing the Second Project
        5. Getting Ready to Move On
        6. Chapter Summary
        7. Exercises
      2. 8. Using Key-Value Coding (KVC)
        1. Setting Up a Controlled Testing Environment
        2. Implementing KVC
        3. Testing iCloud on iOS Simulator
        4. Preparing Your Project for Testing
        5. Sharing the Key-Value Store for the Round Trip
        6. Setting Up and Using NSUbiquitousKeyValueStore
          1. Looking at the Methods
          2. Working with the Store
          3. Preparing the User Interface
          4. Setting Up the Store at Runtime
          5. Monitoring Store Changes
          6. Monitoring Interface Changes
        7. Chapter Summary
        8. Exercises
      3. 9. Using Preferences, Settings, and Keychains with iCloud
        1. Using Property Lists
          1. Looking at Property Lists
          2. Looking Inside a Property List
          3. Reading and Writing Property Lists
          4. Using NSData Objects in Property Lists
          5. Using Scalars in Property Lists
        2. Working with User Defaults
          1. Can the User Set Defaults?
          2. How Frequently Are Defaults Changed?
          3. Where Should the Defaults and Settings Be Located?
          4. How Do You Use iCloud with Your User Defaults?
        3. Registering Defaults
        4. Chapter Summary
        5. Exercises
      4. 10. Managing Persistent Storage with Core Data
        1. Understanding the Goals of Core Data
          1. Understanding Object Graphs
          2. Introducing Faulting
          3. Introducing the Data Model
        2. Structuring Data
          1. Properties
          2. Relationships
          3. Normalizing Data
          4. Denormalizing Data
        3. Understanding How Core Data Works with iCloud
        4. Introducing the Core Data Project
        5. Using the Xcode Data Modeling Tool
          1. Managing the Data Model
          2. Working with Entities
          3. Converting Entities to Objects
          4. Using the Object
        6. Examining the Core Data Stack
        7. Chapter Summary
        8. Exercises
      5. 11. Using Xcode Workspaces for Shared Development
        1. Building on the Digital Hub
        2. Reviewing Xcode File Management
        3. Setting Up a Multiproject Workspace
        4. Creating a Multiproject Workspace
        5. Chapter Summary
        6. Exercise
      6. 12. Adding Data to Apps with Bundles and Resources
        1. Packages, Bundles, and Resources
          1. Adding Files to Your App’s Bundle
          2. Getting Files Out of the Bundle
        2. Looking at Sandboxed Files
          1. Setting Up Sandboxing
          2. Looking Inside Sandboxing Containers on OS X
          3. Writing to Your Sandbox
        3. Including Property Lists
          1. Adding the Property List to Your App
          2. Reading the Property List into an NSDictionary
        4. Including a Core Data Store
        5. Chapter Summary
        6. Exercises
    14. IV: Using iCloud Documents and Data
      1. 13. Adding the iCloud Infrastructure
        1. Exploring the Workspace for the App
          1. Exploring iOS and OS X Document Architecture Differences
          2. Dealing with UI Differences
          3. Designing the Shared App Folder Structure
          4. Checking Out the End Result
          5. Scoping the Project
        2. Debugging iCloud Apps with developer.icloud.com
        3. Building the App
        4. Creating the Shared Folder
          1. Constants.h
          2. Constants.m
          3. SharediCloudController.h
          4. SharediCloudController.m
        5. Creating the App’s Classes
          1. AppDelegate
          2. MasterViewController
          3. DetailViewController
          4. ReportDocument
          5. Storyboards
        6. Chapter Summary
        7. Exercises
      2. 14. Working with File Wrappers in iCloud
        1. Exploring Files, File Wrappers, and Documents
          1. Looking at Files
          2. Exploring File Wrappers
          3. Exploring Documents
        2. How Users Manage iCloud Files
        3. Starting the Placid Project
          1. Certificates, Identifiers, Devices, and Profiles on developer.apple.com
          2. Certificates, Identifiers, Devices, and Profiles on Xcode 5
          3. Adjusting the General Settings
          4. Setting Images
          5. Configuring Capabilities
          6. Setting Document and Universal Type Identifiers
          7. Checking Build Settings
        4. Writing the Code
          1. AppDelegate
          2. MasterViewController
          3. DetailViewController
          4. WrappedDocument
        5. Working with the Storyboard
        6. Chapter Summary
        7. Exercises
      3. 15. Working with iOS Documents
        1. Planning the App’s Structure
          1. Choosing between Navigation and Split View Controller on iPad
          2. Deciding on a Structure
        2. Starting the Loon Project
          1. Setting Project General Info
          2. Setting Project Capabilities
          3. Setting Up Documents
          4. Adding Settings
        3. Writing the Code
          1. AppDelegate
          2. MasterViewController
          3. DetailViewController
          4. WrappedDocument
          5. FileRepresentation
        4. Chapter Summary
        5. Exercises
      4. 16. Working with OS X Documents
        1. Evolution of NSDocument and UIDocument Differences
        2. Planning the Project
        3. Starting the Chazy Project
          1. Setting Up the App in Xcode
          2. Changing Document to WrappedDocument
          3. Adding an App Delegate (If Necessary)
        4. Writing the Code
          1. WrappedDocument
          2. WindowController
        5. Testing the App
        6. Chapter Summary
        7. Exercises
      5. 17. Working with Core Data and iCloud
        1. Looking at the iCloud Core Data Implementation
          1. Using the Class Extension for the Snippets in This Chapter
          2. Using the Options Dictionary
        2. Fallback Stores
        3. Setting Up and Managing Persistent Stores
          1. Setting Up a Persistent Store Asynchronously
          2. Managing Persistent Store Changes
        4. Managing Account Changes
        5. Database Migration
          1. Putting Data Model Changes in Perspective
          2. Starting Over
        6. Chapter Summary
        7. Exercises
      6. 18. Completing the Round Trip
        1. How the User Sees the Round Trip
          1. Working with the Open Dialog on OS X
          2. Working with a Split View Controller on iOS
          3. Examining iCloud Files in System Preferences on OS X
          4. Examining iCloud Files with Settings on iOS
        2. How the Developer Sees the Round Trip
          1. Using developer.icloud.com
          2. Using Xcode
        3. Configuring the Shared Ubiquity Container
        4. Using a Shared iCloud Controller
          1. Making the App Delegate Link to the Controller
          2. Declaring the Shared iCloud Controller
          3. Implementing the Shared iCloud Controller
        5. Moving Documents to iCloud
        6. Moving Documents from iCloud to Local Storage
        7. Chapter Summary
        8. Exercises
    15. Index

    Product information

    • Title: Learning iCloud Data Management: A Hands-On Guide to Structuring Data for iOS and OS X
    • Author(s): Jesse Feiler
    • Release date: February 2014
    • Publisher(s): Addison-Wesley Professional
    • ISBN: 9780133134018