Document no longer synch with local couchbase server

Hi…

I have installed the couchbase lite, couchbase server and synch locally on my MAC. When I saved the data, it saved and synched successfully as I can see that the saved document is in the couchbase server. That was 2 days ago.

I ran my app today to save the document and was still able to save successfully via “putProperties” method as before but when I looked into the couchbase server, the saved document is not there. I did few refreshes but no luck.

When I retrieved the data via live query, the saved document did show up. I am thinking that it’s saved on the couchbase lite and somehow it can no longer synched back to the couchbase server.

Can you please pinpoint me to where I should check? I am linking to the couchbase server using administrative account so that shouldn’t be a problem.

UPDATE: I found the error. It’s in my own code for the synch function. Thanks…

Hey @woody_12,

May you described what you changed in sync function to resolve the issue you reported for the community?

It was actually a dumb mistake I did. But this is what happened:

I created the model class and moved the CBL code which was on AppDelegate to the class.

// CBLModel.h
@interface CBLEventData : CBLModel {}

// CBLModel.m
@interface CBLEventData () {

CBLReplication *_pull;
CBLReplication *_push;
NSError *_lastSyncError;

CBLDatabase *_database;
CBLUITableSource *_dataSource;

}
@implementation

// Create startSync method.

  • (void)startSync {

    NSURL *syncUrl = [NSURL URLWithString:kSyncUrl];
    if (!syncUrl)
    return;

    */ I had “self.database” instead of _database here earlier. self.database was not declared so it was nil
    classic copy and paste error since I moved it from app delegate where I declared
    @property(nonatomic, strong, readonly) CBLDatabase database
    Although the code didn’t crash, it wasn’t synching either /

    _pull = [_database createPullReplication:syncUrl];
    _push = [_database createPushReplication:syncUrl];

    _pull.continuous = _push.continuous = YES;

    id auth;
    auth = [CBLAuthenticator basicAuthenticatorWithName:
    password: ];
    _push.authenticator = _pull.authenticator = auth;

    // Observe replication progress changes, in both directions:
    NSNotificationCenter *nctr = [NSNotificationCenter defaultCenter];
    [nctr addObserver:self selector:@selector(replicationProgress:)
    name:kCBLReplicationChangeNotification object:_pull];
    [nctr addObserver:self selector:@selector(replicationProgress:)
    name:kCBLReplicationChangeNotification object:_push];
    [_push start];
    [_pull start];
    }


@end