O'Reilly logo

Xcode 4 Cookbook by Steven F. Daniel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required