RLMSyncError
Objective-C
enum RLMSyncError : NSInteger {}
Swift
typealias RLMSyncError.Code._ErrorType = RLMSyncError
An error related to a problem that might be reported by the synchronization manager error handler, or a callback on a sync-related API that performs asynchronous work.
-
An error that indicates a problem with the session (a specific Realm opened for sync).
Declaration
Objective-C
RLMSyncErrorClientSessionError = 4
Swift
case clientSessionError = 4
-
An error that indicates a problem with a specific user.
Declaration
Objective-C
RLMSyncErrorClientUserError = 5
Swift
case clientUserError = 5
-
An error that indicates an internal, unrecoverable problem with the underlying synchronization engine.
Declaration
Objective-C
RLMSyncErrorClientInternalError = 6
Swift
case clientInternalError = 6
-
An error that indicates the Realm needs to be reset.
A synced Realm may need to be reset because Atlas App Services encountered an error and had to be restored from a backup. If the backup copy of the remote Realm is of an earlier version than the local copy of the Realm, the server will ask the client to reset the Realm.
The reset process is as follows: the local copy of the Realm is copied into a recovery directory for safekeeping, and then deleted from the original location. The next time the Realm for that partition value is opened, the Realm will automatically be re-downloaded from Atlas App Services, and can be used as normal.
Data written to the Realm after the local copy of the Realm diverged from the backup remote copy will be present in the local recovery copy of the Realm file. The re-downloaded Realm will initially contain only the data present at the time the Realm was backed up on the server.
The client reset process can be initiated in one of two ways.
The
userInfo
dictionary contains an opaque token object under the keykRLMSyncErrorActionTokenKey
. This token can be passed into+[RLMSyncSession immediatelyHandleError:]
in order to immediately perform the client reset process. This should only be done after your app closes and invalidates every instance of the offending Realm on all threads (note that autorelease pools may make this difficult to guarantee).If
+[RLMSyncSession immediatelyHandleError:]
is not called, the client reset process will be automatically carried out the next time the app is launched and theApp
is initialized.The value for the
kRLMSyncPathOfRealmBackupCopyKey
key in theuserInfo
dictionary describes the path of the recovered copy of the Realm. This copy will not actually be created until the client reset process is initiated.See
-[NSError rlmSync_errorActionToken]
,-[NSError rlmSync_clientResetBackedUpRealmPath]
Declaration
Objective-C
RLMSyncErrorClientResetError = 7
Swift
case clientResetError = 7
-
An error that indicates the user does not have permission to perform an operation upon a synced Realm. For example, a user may receive this error if they attempt to open a Realm they do not have at least read access to, or write to a Realm they only have read access to.
This error may also occur if a user incorrectly opens a Realm they have read-only permissions to without using the
asyncOpen()
APIs.A Realm that suffers a permission denied error is, by default, flagged so that its local copy will be deleted the next time the application starts.
The
userInfo
dictionary contains an opaque token object under the keykRLMSyncErrorActionTokenKey
. This token can be passed into+[RLMSyncSession immediatelyHandleError:]
in order to immediately delete the local copy. This should only be done after your app closes and invalidates every instance of the offending Realm on all threads (note that autorelease pools may make this difficult to guarantee).Warning
It is strongly recommended that, if a Realm has encountered a permission denied error, its files be deleted before attempting to re-open it.
See
-[NSError rlmSync_errorActionToken]
Declaration
Objective-C
RLMSyncErrorPermissionDeniedError = 9
Swift
case permissionDeniedError = 9
-
An error that indicates that the server has rejected the requested flexible sync subscriptions.
Declaration
Objective-C
RLMSyncErrorInvalidFlexibleSyncSubscriptions = 10
Swift
case invalidFlexibleSyncSubscriptions = 10
-
An error that indicates that the server has reverted a write made by this client. This can happen due to not having write permission, or because an object was created in a flexible sync Realm which does not match any active subscriptions.
This error is informational and does not require any explicit handling.
Declaration
Objective-C
RLMSyncErrorWriteRejected = 11
Swift
case writeRejected = 11
-
A connection error without a more specific error code occurred.
Realm internally handles retrying connections with appropriate backoffs, so connection errors are normally logged and not reported to the error handler. The exception is if
RLMSyncConfiguration.cancelAsyncOpenOnNonFatalErrors
is set totrue
, in which case async opens will be canceled on connection failures and the error will be reported to the completion handler.Note that connection timeouts are reported as (errorDomain: NSPosixErrorDomain, error: ETIMEDOUT) and not as one of these error codes.
Declaration
Objective-C
RLMSyncErrorConnectionFailed = 12
Swift
case connectionFailed = 12
-
Connecting to the server failed due to a TLS issue such as an invalid certificate.
Declaration
Objective-C
RLMSyncErrorTLSHandshakeFailed = 13
Swift
case tlsHandshakeFailed = 13
-
The server has encountered an error that it wants the user to know about, but is not necessarily fatal.
An error with this code may indicate that either sync is not enabled or it’s trying to connect to an edge server app.
Declaration
Objective-C
RLMSyncErrorServerWarning = 14
Swift
case serverWarning = 14