Search code examples
realmswift3

Realm in Swift3.0 unexpected status code: -34018


run this code

SyncUser.authenticate(with: Credential.usernamePassword(username: username, password: password, actions: [.useExistingAccount]), server: Constants.syncAuthURL) { (user, error) in }

return -34018 error code

libc++abi.dylib: terminating with uncaught exception of type realm::keychain::KeychainAccessException: Keychain returned unexpected status code: -34018

breakpoint in

_dispatch_once(dispatch_once_t *predicate,
    DISPATCH_NOESCAPE dispatch_block_t block){
if (DISPATCH_EXPECT(*predicate, ~0l) != ~0l) {
    dispatch_once(predicate, block);
} else {
    dispatch_compiler_barrier();
}
DISPATCH_COMPILER_CAN_ASSUME(*predicate == ~0l);}

THX


Solution

  • -34018 means errSecMissingEntitlement. Try to specify an entitlements file, even if it contains no entitlements, can work around this problem.

    See more at: https://github.com/realm/realm-cocoa/issues/4158