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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.