How do you detect when a file is modified in iCloud?

When a file is modified in iCloud (added, deleted, or modified content), I would like to call the method that I created ( [self methodName]) so that I can update the table view with the names of the new files. How can I get file change notification? Do I need to listen to NSNotification (if so, what is it?) Or do I need to check manually? Thank.

+5
source share
2 answers

The name NSNotification I have to listen to is this NSMetadataQueryDidUpdateNotification. Here is how I did it:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryDidUpdate:) name:NSMetadataQueryDidUpdateNotification object:query];

...

-(void)queryDidUpdate:(NSNotification *)notification {

    //something changed, reload (NSMetadataQuery, create NSPredicate, rerun the query, etc.)

}
+5
source

This section of the Apple Developer website provides a great guide to customizing document-based iCloud applications.

, : UIDocument, . " ". , .

+1

All Articles