Issue with Couchbase integration in iOS

#pragma mark - Replication

  • (void)startReplicator:(NSString *)username password:(NSString *)password {
    // if (!kSyncEnabled)
    // return;

CBLURLEndpoint *target = [[CBLURLEndpoint alloc] initWithURL:[NSURL URLWithString:@“ws://localhost:4094”]];
CBLReplicatorConfiguration *config = [[CBLReplicatorConfiguration alloc] initWithDatabase:_database target:target];
config.continuous = YES;
config.authenticator = [[CBLBasicAuthenticator alloc] initWithUsername:username password:password];

_replicator = [[CBLReplicator alloc] initWithConfig:config];
__weak typeof(self) wSelf = self;
[_replicator addChangeListener:^(CBLReplicatorChange *change) {
CBLReplicatorStatus *s = change.status;
NSError *e = s.error;
NSLog(@"[Todo] Replicator: %@ %llu/%llu, error: %@",
[wSelf ativityLevel: s.activity], s.progress.completed,, e);
[UIApplication.sharedApplication setNetworkActivityIndicatorVisible: s.activity == kCBLReplicatorBusy];
if (e.code == 401) {
[CBLUi showMessageOn:wSelf.window.rootViewController
title:@“Authentication Error”
message:@“Your username or passpword is not correct.”
[wSelf logout];

[_replicator start];

By reading what you have posted, it seems you are trying to start the replicator. What is the issue you are trying to bringing up here? Do you have problem to run with this block of code?