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

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK now with O’Reilly online learning.

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