Hi,
I am going through the doc (https://docs.realm.io/sync/using-synced-realms/errors#client-reset) to handle client reset error and found it’s very confusing . I have two questions about the following code.
-
First there is no method available to closeRealmsafely. can you please help me understand how can I close the realm safely?
-
How can I backup and when I will use it?
-
Should I skip the reset error because in documentation it’s mentions “if the client reset process is not manually initiated, it will instead automatically take place after the next time the app is launched, upon first accessing the SyncManager singleton. It is the app’s responsibility to persist the location of the backup copy if needed, so that the backup copy can be found later.”
Below is the error handler sample code from the doc.
SyncManager.shared.errorHandler = { error, session in
let syncError = error as! SyncError
switch syncError.code {
case .clientResetError:
if let (path, clientResetToken) = syncError.clientResetInfo() {
closeRealmSafely()
saveBackupRealmPath(path)
SyncSession.immediatelyHandleError(clientResetToken)
}
default:
// Handle other errors...
()
}
}