SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This PDF will be accessible from your Account page after purchase and requires PDF reading software, such as Acrobat® Reader®.
The eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
“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
Preface xvii
Acknowledgments xxiii
About the Author xxv
Introduction 1
Part I: Introducing iCloud 3
Chapter 1: Exploring iCloud and Its User Experience 5
Looking at Cloud Computing 5
Understanding the iCloud Paradigm 7
Making the Round Trip 14
Chapter Summary 14
Exercises 15
Chapter 2: Setting Up iCloud for Development 17
Managing App Security on iOS and OS X 18
Looking Inside the iCloud Basics 23
Using iCloud in Your App 30
Chapter Summary 31
Exercises 32
Part II: Using the APIs 33
Chapter 3: Introducing the APIs and the First Apps 35
Getting Started as an Apple Developer 35
Looking at the APIs 37
Introducing the Built-In Data Apps 38
Wiring Up the Interfaces 50
Chapter Summary 55
Exercises 55
Chapter 4: Working with the AddressBook API for Contacts 57
Considering the AddressBook API on iOS and OS X 57
Sending Mail from the iOS App 58
Sending Mail from the OS X App 65
Using Property Lists for Storing and Syncing 65
Chapter Summary 66
Exercises 67
Chapter 5: Managing Calendars and Reminders with the Event Kit API 69
Exploring the Event Class Hierarchy 70
Setting OS X Permissions 71
Working with the Calendar Database 72
Adding a Reminder to the App on iOS 80
Adding an Event to the App on OS X 83
Chapter Summary 85
Exercises 85
Chapter 6: Protecting the Privacy of User Data 87
The Need for Privacy 87
Looking at Apple’s Rules and Guidelines 88
Best Practices in App Privacy 88
Chapter Summary 93
Exercises 93
Part III: Using the Technologies 95
Chapter 7: Introducing Blocks, Threads, and Notifications 97
Catching Up with Blocks and Threads 98
Getting Up to Speed with Notifications 100
Receiving Notification of iCloud Availability Changes 102
Introducing the Second Project 103
Getting Ready to Move On 103
Chapter Summary 104
Exercises 104
Chapter 8: Using Key-Value Coding (KVC) 105
Setting Up a Controlled Testing Environment 106
Implementing KVC 106
Testing iCloud on iOS Simulator 107
Preparing Your Project for Testing 108
Sharing the Key-Value Store for the Round Trip 110
Setting Up and Using NSUbiquitousKeyValueStore 111
Chapter Summary 120
Exercises 120
Chapter 9: Using Preferences, Settings, and Keychains with iCloud 121
Using Property Lists 122
Working with User Defaults 128
Registering Defaults 130
Chapter Summary 131
Exercises 131
Chapter 10: Managing Persistent Storage with Core Data 133
Understanding the Goals of Core Data 134
Structuring Data 135
Understanding How Core Data Works with iCloud 139
Introducing the Core Data Project 139
Using the Xcode Data Modeling Tool 142
Examining the Core Data Stack 154
Chapter Summary 155
Exercises 155
Chapter 11: Using Xcode Workspaces for Shared Development 157
Building on the Digital Hub 158
Reviewing Xcode File Management 159
Setting Up a Multiproject Workspace 162
Creating a Multiproject Workspace 163
Chapter Summary 167
Exercise 168
Chapter 12: Adding Data to Apps with Bundles and Resources 169
Packages, Bundles, and Resources 169
Looking at Sandboxed Files 176
Including Property Lists 181
Including a Core Data Store 183
Chapter Summary 184
Exercises 184
Part IV: Using iCloud Documents and Data 185
Chapter 13: Adding the iCloud Infrastructure 187
Exploring the Workspace for the App 188
Debugging iCloud Apps with developer.icloud.com 195
Building the App 199
Creating the Shared Folder 201
Creating the App’s Classes 215
Chapter Summary 230
Exercises 230
Chapter 14: Working with File Wrappers in iCloud 231
Exploring Files, File Wrappers, and Documents 231
How Users Manage iCloud Files 233
Starting the Placid Project 236
Writing the Code 246
Working with the Storyboard 270
Chapter Summary 270
Exercises 270
Chapter 15: Working with iOS Documents 273
Planning the App’s Structure 274
Starting the Loon Project 276
Writing the Code 280
Chapter Summary 315
Exercises 315
Chapter 16: Working with OS X Documents 317
Evolution of NSDocument and UIDocument Differences 317
Planning the Project 319
Starting the Chazy Project 321
Writing the Code 326
Testing the App 337
Chapter Summary 338
Exercises 338
Chapter 17: Working with Core Data and iCloud 339
Looking at the iCloud Core Data Implementation 339
Fallback Stores 341
Setting Up and Managing Persistent Stores 342
Managing Account Changes 344
Database Migration 345
Chapter Summary 348
Exercises 348
Chapter 18: Completing the Round Trip 349
How the User Sees the Round Trip 350
How the Developer Sees the Round Trip 362
Configuring the Shared Ubiquity Container 366
Using a Shared iCloud Controller 368
Moving Documents to iCloud 376
Moving Documents from iCloud to Local Storage 377
Chapter Summary 378
Exercises 378
Index 379