Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
- (void) observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
{
// push & pull Action
if (object == self.pull || object == self.push) {
// レプリケーションモードを取得
CBLReplicationMode mode;
if (object == self.pull){
mode = _pull.mode;
}
else{
mode = _push.mode;
}
LOG(@"mode %d", mode);
// モードによって動作を変更する
switch (mode) {
// finish or error
case kCBLReplicationStopped:{
[self loadAllDocuments];
break;
}
// db offline
case kCBLReplicationOffline:{
break;
}
default:
// kCBLReplicationActive & kCBLReplicationIdle
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.