TWRCouchDBClient是一个用于与CouchDB API交互的AFHTTPSessionManager子类。
注意:该代码尚处于开发初期阶段,因此在将其集成到生产代码时要格外小心。
TWRCouchDBClient *client = [[TWRCouchDBClient alloc] initWithBaseURL:@"http://127.0.0.1:5984" sessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
[client changesSince:@"0" limit:100 descending:NO feed:TWRSyncChangesFeedTypeNormal heartbeat:60000 timeout:60000 filter:nil includeDocs:YES style:TWRSyncChangesFeedStyleAllDocs completion:^(NSDictionary *changes, NSError *error) {
if (error) {
NSLog(@"Error getting changes: %@",[error localizedDescription]);
return;
}
// do something with changes feed...
}];
Alexander Edge
TWRCouchDBClient在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。