Skip to content

Instantly share code, notes, and snippets.

@kuetsuhara
Created January 9, 2014 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuetsuhara/8331912 to your computer and use it in GitHub Desktop.
Save kuetsuhara/8331912 to your computer and use it in GitHub Desktop.
- (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