␡
- Setting Up an iCloud-Compatible Project
- How iCloud Works
- iCloud Container Folders
- Recipe: Trying Out iCloud
- Working with UIDocument
- Recipe: Subclassing UIDocument
- Metadata Queries and the Cloud
- Handy Routines
- Recipe: Accessing the Ubiquitous Key-Value Store
- Recipe: UIManagedDocument and Core Data
- Summary
< Back
Page 11 of 11
This chapter is from the book
Summary
This chapter introduced iCloud and its ability to manage ubiquitous data. In it, you discovered the basics of how to integrate its features in your own applications. You saw how to create new provisions and entitlements, learned what’s going on under the hood, and discovered how to integrate iCloud access into your applications. Here are a few final thoughts to take with you:
- Once you hand over control to a UIDocument subclass, there’s little you need to do other than to save your changes and update your undo manager on a regular basis.
- While accepting the most recently saved item is a really easy way to go with conflict resolution, it’s not necessarily the best way. Role-play how your application might be used in the real world, with all kinds of possible conflicts, and design your resolution strategy around that.
- If you are working with Core Data, use UIManagedDocument and its built-in Core Data integration rather than subclassing UIDocument.
- UIManagedDocument takes a simple “last-changed wins” philosophy to life. Once you update your code with the elements shown in Recipe 18-4, you can keep re-using those elements across all your projects. Unlike UIDocument-based apps, which require more nuanced thinking, the managed document’s conflict resolution strategy can be used over and over again. That makes Core Data and UIManagedDocument a powerfully simple solution for iCloud integration.
- Details matter. When it comes to iCloud, you must punch every point in the process. You can use a simple Recipe 18-1 “Hello World”–style test to ensure that you’re correctly accessing the cloud with your entitlements before moving on to more complicated matters. Don’t forget to register your document as a file presenter.
- The reason you use your developer ID with your entitlements is to allow access between all your applications. You can create a suite of applications that all work together, allowing file transfer using a shared iCloud storage container.
- Use key-value stores to provide a continuous user experience, so your user can pick up on a new device where he or she left off on another. KV stores are meant to enhance, not replace, user defaults.
- iCloud shares data between devices for a single account, and for a single developer’s applications. Multiple user accounts cannot share data into a central source and separate developers cannot create shared folders. If you need this functionality, look to providers outside iCloud or build your own Web service.
- Unlike iOS, Mac OS X HFS+ file names are generally case insensitive. Creating container IDs and file names that differ only by case will produce unhappy development outcomes. Design your iOS apps to be Mac-safe from the start and vice versa.
- Users pay for cloud storage. So, use it wisely or not at all. A little state data can go a long way, and a lot of media storage will get you nowhere fast.
< Back
Page 11 of 11