In order to monitor file changes in my iCloud container, I've registered for
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(processiCloudUpdates:)
name:NSMetadataQueryDidUpdateNotification
object:nil];
Ideally, whenever I receive the message that updates have been made, I'd like to open each of my UIDocs and check if settings have been changed. This would be fine, if NSMetadataQueryDidUpdateNotification
was only called once. However, it is being fired several times (I did not forget to removeObserver
etc. and have several instances running), and it would thus make it highly impractical to load all files every time the update notification is being fired (if I had 5 files and this is being called 4 times, I'd open 20 UIDocs in quick succession). For instance, this happens if I update one file (and only have one file in my ubiquitous container):
2012-07-05 10:51:39.565 Meernotes[7842:707] ... NSMetadataQuery update
2012-07-05 10:51:42.468 Meernotes[7842:707] ... NSMetadataQuery update
2012-07-05 10:51:45.216 Meernotes[7842:707] ... NSMetadataQuery update
2012-07-05 10:51:47.036 Meernotes[7842:707] ... NSMetadataQuery update
Is there any other way to determine when a file has changed? NSFileVersion did not help much either.