[Replicator Error: Permanent Redirect] Sync not working in iOS
dsourav opened this issue · comments
Sourov Das commented
Description
Hi I am trying to use Couchbase Lite package in flutter . I am trying to use replicator to sync data. The data sync is working in Android properly but it's not working in IOS. I am getting Replicator Error: Permanent Redirect.
Project Configuration
flutter sdk version: 1.22.5
couchbase_lite: ^2.7.1
Code
final syncGatewayUser = await SharedPreferencesHelper.getSyncGatewayUser();
if (syncGatewayUser != null && syncGatewayUser.password != null) {
var decryptedPassword = await decryptString(syncGatewayUser.password, _syncSecret);
ReplicatorConfiguration config =
ReplicatorConfiguration(CouchbaseLite._database,"ws://test-sync.ledger-manager.com/lmbucket");
config.replicatorType = ReplicatorType.pushAndPull;
config.continuous = true;
config.authenticator = BasicAuthenticator(syncGatewayUser.name, decryptedPassword);
_replicator = Replicator(config);
var token = _replicator.addChangeListener((ReplicatorChange event) {
if (event.status.error != null) {
print("Replicator Error: " + event.status.error);
}
_replicatorToStream.add(event.status.activity);
_replicatorToStream
.where((event) => event == ReplicatorActivityLevel.idle)
.zipWith(_replicatorToStream.debounceTime(Duration(milliseconds: 400)), (t, s) => s)
.listen((event) {
if (event == ReplicatorActivityLevel.idle) replicatorListener.add(ReplicatorActivityLevel.idle);
});
});
// todo - enable replication later
await _replicator.start();
}