[[NSNotificationCenter defaultCenter] addObserverForName: kCBLDatabaseChangeNotification
object: myDatabase
queue: nil
usingBlock: ^(NSNotification *n) {
CBLDatabaseChange* change = n.object;
NSLog(@"Document '%@' changed.", change.documentID);
}
];
/** This notification is posted by a CBLDatabase in response to document changes.
The notification's userInfo dictionary's "changes" key contains an NSArray of
CBLDatabaseChange objects that describe the revisions that were added. */
A correct implementation for the block use the array to access changes.
NSArray *changes = [n.userInfo valueForKey:@"changes"];
for (CBLDatabaseChange *change in changes) {
NSLog(@"Document '%@' changed.", change.documentID);
}
This section in the documentation is incorrect.