How do you detect when a file is changed in iCloud?
icloud, ios, ipad, iphone, objective-c
Solution
The name of the NSNotification I have to listen for is `NSMetadataQueryDidUpdateNotification`. This 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.)
}
Problem
When a file is changed in iCloud (whether added, deleted, or the content changed), I would like to call a method I created (`[self methodName]`) so that I can update my table view with the names of the new files. How am I notified of the file change? Do I need to listen for a NSNotification (if so, what is it?) or do I have to check manually? Thanks.