RealmSwift Problem in Xcode 14 beta. Showstopper

I’m trying out the new macOS, iOS, and Xcode from WWDC22.

I’m getting the error:

Thread 1: “Keychain returned unexpected status code: -34018”

when I’m creating a RealmSwift.app with:

let ra = RealmSwift.App(id: “foody23realm-jfsbk”)

this line has worked in earlier versions.

I don’t really expect Realm to fully support Apple’s beta software, but I thought you could use a heads up about the error and I could warn other users contemplating testing it at this time.

Stack trace below:


2022-06-11 14:08:29.896260-0400 Foody22[5530:81226] *** Terminating app due to uncaught exception 'RLMException', reason: 'Keychain returned unexpected status code: -34018'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000180406ec4 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x000000018004c08c objc_exception_throw + 56
	2   Foody22                             0x000000010084b6d0 _ZL17RLMTranslateErrorIZ49-[RLMApp initWithId:configuration:rootDirectory:]E3$_0EDaOT_ + 128
	3   Foody22                             0x000000010084b4ec -[RLMApp initWithId:configuration:rootDirectory:] + 428
	4   Foody22                             0x000000010084b9f8 +[RLMApp appWithId:configuration:rootDirectory:] + 288
	5   Foody22                             0x000000010084bb4c +[RLMApp appWithId:configuration:] + 92
	6   Foody22                             0x000000010084bc08 +[RLMApp appWithId:] + 68
	7   Foody22                             0x00000001006d928c $sSo6RLMAppC2idABSS_tcfCTO + 56
	8   Foody22                             0x00000001006d9188 $s7Foody2210FoodyRealmVACycfC + 1008
	9   Foody22                             0x00000001007c64b4 $s7Foody220A3AppVACycfC + 76
	10  Foody22                             0x00000001007c6ca4 $s7Foody220A3AppV7SwiftUI0B0AadEPxycfCTW + 12
	11  SwiftUI                             0x0000000109cd2e88 OUTLINED_FUNCTION_9 + 76
	12  Foody22                             0x00000001007c63f4 $s7Foody220A3AppV5$mainyyFZ + 40
	13  Foody22                             0x00000001007c6cb8 main + 12
	14  dyld                                0x000000010471df94 start_sim + 20
	15  ???                                 0x000000010487dc10 0x0 + 4370979856
	16  ???                                 0x1848000000000000 0x0 + 1749648455233437696
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'RLMException', reason: 'Keychain returned unexpected status code: -34018'
terminating with uncaught exception of type NSException
CoreSimulator 842.7 - Device: iPhone 12 (4B30EC69-0DEF-46B0-890B-AAA0FC6B380E) - Runtime: iOS 16.0 (20A5283p) - DeviceType: iPhone 12

One more note: Package version…

let coreVersionStr = “12.1.0”

let cocoaVersionStr = “10.28.1”

One more note:

This error occurs with iPhone and iPad simulators.
It also occurs with a target of My Mac (Designed for iPad)

However, it does not occur with a target of My Mac.

It’s now working with an iPhone 12 running iOS 16.

However it’s still failing in simulators and in My Mac (Designed for iPad).

I’m seeing the same behaviour. Works on device, not on simulators.

1 Like

Xcode 14 beta 3.
It now works on iPad simulator, but not on

  • Mac Designed for iPad
  • Mac Catalyst
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'RLMException', reason: 'Keychain returned unexpected status code: -34018'
terminating with uncaught exception of type NSException

I had to add Keychain Sharing capability to the target to make the app works on iPhone simulators (beta 4), not sure why though…

I am having the same issue in beta 4. Adding “Keychain sharing” as a capability in targets fixed the issue for me.

I filed an issue on the GitHub repo for reference: https://github.com/realm/realm-swift/issues/7915