O'Reilly logo

iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK by Joe Keeley, Kyle Richter

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

Listing Documents in iCloud

To show the list of notes created and available, the app needs to query the iCloud directory to find out what files are there. This is done with an NSMetadataQuery.

- (NSMetadataQuery*)noteListQuery{    NSMetadataQuery *setupQuery = [[NSMetadataQuery alloc] init];    [setupQuery setSearchScopes:    @[NSMetadataQueryUbiquitousDocumentsScope]];    NSString *filePattern = [NSStringstringWithFormat:    @"*.%@",kICFMyNoteDocumentExtension];    [setupQuery setPredicate:[NSPredicate predicateWithFormat:    @"%K LIKE %@",NSMetadataItemFSNameKey,filePattern]];    return setupQuery;}

The NSMetadataQuery is set up with the NSMetadataQueryUbiquitousDocumentsScope search scope, which is the iCloud ...

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