mongodb / stitch-ios-sdk

Apache License 2.0
42 stars 25 forks source link

`RemoteMongoCollection.sync` fails #193

Open funct7 opened 4 years ago

funct7 commented 4 years ago

Currently trying to observe a collection after the user is signed in. However, I keep getting couldNotLoadSyncInfo.

The error seems to be emitted from:

https://github.com/mongodb/stitch-ios-sdk/blob/d18f382235c95a17cd375ee36b0543772b10317c/Core/Services/StitchCoreRemoteMongoDBService/Sources/StitchCoreRemoteMongoDBService/Sync/Internal/DataSynchronizer.swift#L1613-L1616

I also found that during the configuration phase, the method returns at:

https://github.com/mongodb/stitch-ios-sdk/blob/d18f382235c95a17cd375ee36b0543772b10317c/Core/Services/StitchCoreRemoteMongoDBService/Sources/StitchCoreRemoteMongoDBService/Sync/Internal/DataSynchronizer.swift#L295-L297

The following code snippet is my code for configuring the database sync:

// `db` is a `RemoteMongoDatabase` instance.
// `event` is an extension returning a `RemoteMongoCollection` instance
db.event.sync.configure(
    conflictHandler: DefaultConflictHandler<Event>.remoteWins())
{ (result) in
    switch result {
    case .success:
        canSyncEvent = true
    case .failure(let error):
        error.record()
        canSyncEvent = false
    }
}