Storing and using documents within iCloud

In this recipe, we will learn about the different methods that can be used to store and use documents within iCloud.

Getting ready

In this section, we will learn about the file coordinator and the file presenter classes and how the UIDocument class can be registered to receive updates whenever the iCloud data gets updated.

How to do it...

The following example shows how to use the NSFileCoordinator class:

myDocument = [[myDocument alloc] initWithFileURL:ubiquityURL];
myDocument.delegate = self;
coordinator = [[NSFileCoordinator alloc]    
               initWithFilePresenter:myDocument];    
               [NSFileCoordinator addFilePresenter:myDocument];

The job of a file coordinator is to coordinate the reads and writes performed by your application ...

Get Xcode 4 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.