Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//まずは、以下のプロパティを宣言します。
@property (nonatomic, strong) CBLReplication *pull;
@property (nonatomic, strong) CBLReplication *push;
//そして、以下のようなメソッドを作ります。
- (void)syncServer{
// sync method
AppDelegate *ap = ApplicationDelegate;
NSArray *repls = [ap.database replicateWithURL:[NSURL URLWithString:@"https://yourId:password@yourId.cloudant.com/dbName"]
exclusively:YES];
self.pull = [repls objectAtIndex: 0];
self.push = [repls objectAtIndex: 1];
// completeではなく、modeを取得する
// completeの場合、completeしない場合があるため。
[_pull addObserver:self
forKeyPath:@"mode"
options:0
context:NULL];
[_push addObserver:self
forKeyPath:@"mode"
options:0
context:NULL];
}
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.