The MacOS app crashes on startup with 'RLMException', reason: 'Keychain returned unexpected status code: -25291'

Hello,

I have developed a Mac version of the iOS app on Mac Catalyst.
Some users have reported crashes when launching the app.
It didn’t crash on my Mac (OS 11.3.1) during development.

SDK Version: RealmSwift 10.10.0
Xcode Version : 12.5
MacOS Version : 11.5.1

If you have any knowledge about this issue, please let me know.

Logs:

Process:               [MyAppName] [2974]
Path:                  /Applications/[MyAppName].app/Contents/MacOS/[MyAppName]
Identifier:            [MyAppIdentifier]
Version:               1.0.0 (8.0)
App Item ID:           0
App External ID:       0
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           [MyAppName] [2974]
User ID:               501

Date/Time:             2021-08-10 09:33:12.435 -0700
OS Version:            macOS 11.5.1 (20G80)
Report Version:        12
Anonymous UUID:        C9EE8D2D-012A-0021-B12E-7EEFAB4AD056


Time Awake Since Boot: 83000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
*** Terminating app due to uncaught exception 'RLMException', reason: 'Keychain returned unexpected status code: -25291'
terminating with uncaught exception of type NSException
abort() called

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff2059a83b __exceptionPreprocess + 242
1   libobjc.A.dylib                     0x00007fff202d2d92 objc_exception_throw + 48
2   Realm                               0x0000000101bfdfcf -[RLMApp initWithId:configuration:rootDirectory:] + 935
3   Realm                               0x0000000101bfe0fa +[RLMApp appWithId:configuration:rootDirectory:] + 150
4   Realm                               0x0000000101bfe1a5 +[RLMApp appWithId:configuration:] + 20
5   Realm                               0x0000000101bfe1c9 +[RLMApp appWithId:] + 19
6   [MyAppName]                          0x000000010106f49b [MyAppName] + 2135195
7   libdispatch.dylib                   0x00007fff2027d806 _dispatch_client_callout + 8
8   libdispatch.dylib                   0x00007fff2027e98c _dispatch_once_callout + 20
9   libswiftCore.dylib                  0x00007fff2cb2616a swift_once + 26
10  [MyAppName]                          0x0000000101066e21 [MyAppName] + 2100769
11  [MyAppName]                          0x000000010105fd8c [MyAppName] + 2071948
12  [MyAppName]                          0x0000000100f9f495 [MyAppName] + 1283221
13  [MyAppName]                          0x0000000100f9f4e8 [MyAppName] + 1283304
14  UIKitCore                           0x00007fff44558551 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 83
15  UIKitCore                           0x00007fff445426f7 -[UIViewController loadViewIfRequired] + 1309
16  UIKitCore                           0x00007fff445421c5 -[UIViewController view] + 27
17  UIKitCore                           0x00007fff4459a11a -[UIWindow addRootViewControllerViewIfPossible] + 328
18  UIKitCore                           0x00007fff4453027b -[UIWindow _updateLayerOrderingAndSetLayerHidden:actionBlock:] + 222
19  UIKitCore                           0x00007fff4459814c -[UIWindow _setHidden:forced:] + 361
20  UIKitCore                           0x00007fff44597f90 -[UIWindow _mainQueue_makeKeyAndVisible] + 42
21  [MyAppName]                          0x000000010141ef8f [MyAppName] + 6000527
22  [MyAppName]                          0x000000010141de9d [MyAppName] + 5996189
23  UIKitCore                           0x00007fff44524c89 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 287
24  UIKitCore                           0x00007fff44523d53 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4023
25  UIKitCore                           0x00007fff44521856 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1665
26  UIKitCore                           0x00007fff445210ed -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
27  UIKitCore                           0x00007fff4451c92c _UIScenePerformActionsWithLifecycleActionMask + 88
28  UIKitCore                           0x00007fff445207b8 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
29  UIKitCore                           0x00007fff44520599 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 467
30  UIKitCore                           0x00007fff4451f7e5 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 834
31  UIKitCore                           0x00007fff4451f3ff -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345
32  UIKitCore                           0x00007fff4451d199 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 178
33  UIKitCore                           0x00007fff4451daa4 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 855
34  UIKitCore                           0x00007fff4451d2c2 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 246
35  UIKitCore                           0x00007fff4451cd2d -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 361
36  UIKitCore                           0x00007fff4451c30d __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 817
37  UIKitCore                           0x00007fff4451b8f0 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 252
38  UIKitCore                           0x00007fff4451b74a -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 208
39  UIKitCore                           0x00007fff4450f328 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 518
40  UIKitCore                           0x00007fff4450f09c -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 358
41  FrontBoardServices                  0x00007fff3176a4cf -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 398
42  FrontBoardServices                  0x00007fff31787780 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.176 + 102
43  FrontBoardServices                  0x00007fff317596fa -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209
44  FrontBoardServices                  0x00007fff3178745d __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 354
45  libdispatch.dylib                   0x00007fff2027d806 _dispatch_client_callout + 8
46  libdispatch.dylib                   0x00007fff202806fd _dispatch_block_invoke_direct + 241
47  FrontBoardServices                  0x00007fff31759612 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
48  FrontBoardServices                  0x00007fff317a11f3 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 433
49  FrontBoardServices                  0x00007fff317595da -[FBSSerialQueue _performNextFromRunLoopSource] + 22
50  CoreFoundation                      0x00007fff2052094c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
51  CoreFoundation                      0x00007fff205208b4 __CFRunLoopDoSource0 + 180
52  CoreFoundation                      0x00007fff20520634 __CFRunLoopDoSources0 + 242
53  CoreFoundation                      0x00007fff2051f05c __CFRunLoopRun + 893
54  CoreFoundation                      0x00007fff2051e61c CFRunLoopRunSpecific + 563
55  HIToolbox                           0x00007fff28763a83 RunCurrentEventLoopInMode + 292
56  HIToolbox                           0x00007fff287636b6 ReceiveNextEventCommon + 284
57  HIToolbox                           0x00007fff28763583 _BlockUntilNextEventMatchingListInModeWithFilter + 70
58  AppKit                              0x00007fff22d25502 _DPSNextEvent + 864
59  AppKit                              0x00007fff22d23cd5 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1364
60  AppKit                              0x00007fff22d16049 -[NSApplication run] + 586
61  AppKit                              0x00007fff22cea24c NSApplicationMain + 816
62  AppKit                              0x00007fff22fe0cf4 _NSApplicationMainWithInfoDictionary + 16
63  UIKitMacHelper                      0x00007fff340286a3 UINSApplicationMain + 1430
64  UIKitCore                           0x00007fff444f301c UIApplicationMain + 144
65  [MyAppName]                          0x0000000100e71e3a [MyAppName] + 48698
66  libdyld.dylib                       0x00007fff20442f3d start + 1
67  ???                                 0x0000000000000001 0x0 + 1

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib            0x00007fff203f892e __pthread_kill + 10
1   libsystem_pthread.dylib           0x00007fff204275bd pthread_kill + 263
2   libsystem_c.dylib                 0x00007fff2037c406 abort + 125
3   libc++abi.dylib                   0x00007fff203eaef2 abort_message + 241
4   libc++abi.dylib                   0x00007fff203dc5fd demangling_terminate_handler() + 266
5   libobjc.A.dylib                   0x00007fff202d558d _objc_terminate() + 96
6   libc++abi.dylib                   0x00007fff203ea307 std::__terminate(void (*)()) + 8
7   libc++abi.dylib                   0x00007fff203ea2a9 std::terminate() + 41
8   libdispatch.dylib                 0x00007fff2027d81a _dispatch_client_callout + 28
9   libdispatch.dylib                 0x00007fff2027e98c _dispatch_once_callout + 20
10  libswiftCore.dylib                0x00007fff2cb2616a swift_once + 26
11  com.naoyax.CreativePad            0x0000000101066e21 0x100e66000 + 2100769
12  com.naoyax.CreativePad            0x000000010105fd8c 0x100e66000 + 2071948
13  com.naoyax.CreativePad            0x0000000100f9f495 0x100e66000 + 1283221
14  com.naoyax.CreativePad            0x0000000100f9f4e8 0x100e66000 + 1283304
15  com.apple.UIKitCore               0x00007fff44558551 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 83
16  com.apple.UIKitCore               0x00007fff445426f7 -[UIViewController loadViewIfRequired] + 1309
17  com.apple.UIKitCore               0x00007fff445421c5 -[UIViewController view] + 27
18  com.apple.UIKitCore               0x00007fff4459a11a -[UIWindow addRootViewControllerViewIfPossible] + 328
19  com.apple.UIKitCore               0x00007fff4453027b -[UIWindow _updateLayerOrderingAndSetLayerHidden:actionBlock:] + 222
20  com.apple.UIKitCore               0x00007fff4459814c -[UIWindow _setHidden:forced:] + 361
21  com.apple.UIKitCore               0x00007fff44597f90 -[UIWindow _mainQueue_makeKeyAndVisible] + 42
22  com.naoyax.CreativePad            0x000000010141ef8f 0x100e66000 + 6000527
23  com.naoyax.CreativePad            0x000000010141de9d 0x100e66000 + 5996189
24  com.apple.UIKitCore               0x00007fff44524c89 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 287
25  com.apple.UIKitCore               0x00007fff44523d53 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4023
26  com.apple.UIKitCore               0x00007fff44521856 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1665
27  com.apple.UIKitCore               0x00007fff445210ed -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
28  com.apple.UIKitCore               0x00007fff4451c92c _UIScenePerformActionsWithLifecycleActionMask + 88
29  com.apple.UIKitCore               0x00007fff445207b8 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
30  com.apple.UIKitCore               0x00007fff44520599 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 467
31  com.apple.UIKitCore               0x00007fff4451f7e5 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 834
32  com.apple.UIKitCore               0x00007fff4451f3ff -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345
33  com.apple.UIKitCore               0x00007fff4451d199 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 178
34  com.apple.UIKitCore               0x00007fff4451daa4 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 855
35  com.apple.UIKitCore               0x00007fff4451d2c2 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 246
36  com.apple.UIKitCore               0x00007fff4451cd2d -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 361
37  com.apple.UIKitCore               0x00007fff4451c30d __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 817
38  com.apple.UIKitCore               0x00007fff4451b8f0 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 252
39  com.apple.UIKitCore               0x00007fff4451b74a -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 208
40  com.apple.UIKitCore               0x00007fff4450f328 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 518
41  com.apple.UIKitCore               0x00007fff4450f09c -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 358
42  com.apple.FrontBoardServices      0x00007fff3176a4cf -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 398
43  com.apple.FrontBoardServices      0x00007fff31787780 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.176 + 102
44  com.apple.FrontBoardServices      0x00007fff317596fa -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209
45  com.apple.FrontBoardServices      0x00007fff3178745d __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 354
46  libdispatch.dylib                 0x00007fff2027d806 _dispatch_client_callout + 8
47  libdispatch.dylib                 0x00007fff202806fd _dispatch_block_invoke_direct + 241
48  com.apple.FrontBoardServices      0x00007fff31759612 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
49  com.apple.FrontBoardServices      0x00007fff317a11f3 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 433
50  com.apple.FrontBoardServices      0x00007fff317595da -[FBSSerialQueue _performNextFromRunLoopSource] + 22
51  com.apple.CoreFoundation          0x00007fff2052094c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
52  com.apple.CoreFoundation          0x00007fff205208b4 __CFRunLoopDoSource0 + 180
53  com.apple.CoreFoundation          0x00007fff20520634 __CFRunLoopDoSources0 + 242
54  com.apple.CoreFoundation          0x00007fff2051f05c __CFRunLoopRun + 893
55  com.apple.CoreFoundation          0x00007fff2051e61c CFRunLoopRunSpecific + 563
56  com.apple.HIToolbox               0x00007fff28763a83 RunCurrentEventLoopInMode + 292
57  com.apple.HIToolbox               0x00007fff287636b6 ReceiveNextEventCommon + 284
58  com.apple.HIToolbox               0x00007fff28763583 _BlockUntilNextEventMatchingListInModeWithFilter + 70
59  com.apple.AppKit                  0x00007fff22d25502 _DPSNextEvent + 864
60  com.apple.AppKit                  0x00007fff22d23cd5 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1364
61  com.apple.AppKit                  0x00007fff22d16049 -[NSApplication run] + 586
62  com.apple.AppKit                  0x00007fff22cea24c NSApplicationMain + 816
63  com.apple.AppKit                  0x00007fff22fe0cf4 _NSApplicationMainWithInfoDictionary + 16
64  com.apple.UIKitMacHelper          0x00007fff340286a3 UINSApplicationMain + 1430
65  com.apple.UIKitCore               0x00007fff444f301c UIApplicationMain + 144
66  com.naoyax.CreativePad            0x0000000100e71e3a 0x100e66000 + 48698
67  libdyld.dylib                     0x00007fff20442f3d start + 1

Thread 1:
0   libsystem_pthread.dylib           0x00007fff20423420 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib           0x00007fff20423420 start_wqthread + 0

Thread 3:
0   libsystem_pthread.dylib           0x00007fff20423420 start_wqthread + 0

Thread 4:
0   libsystem_pthread.dylib           0x00007fff20423420 start_wqthread + 0

Thread 5:
0   libsystem_pthread.dylib           0x00007fff20423420 start_wqthread + 0

Thread 6:: com.apple.uikit.eventfetch-thread
0   libsystem_kernel.dylib            0x00007fff203f22ba mach_msg_trap + 10
1   libsystem_kernel.dylib            0x00007fff203f262c mach_msg + 60
2   com.apple.CoreFoundation          0x00007fff20520b2f __CFRunLoopServiceMachPort + 316
3   com.apple.CoreFoundation          0x00007fff2051f20f __CFRunLoopRun + 1328
4   com.apple.CoreFoundation          0x00007fff2051e61c CFRunLoopRunSpecific + 563
5   com.apple.Foundation              0x00007fff212ae607 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
6   com.apple.Foundation              0x00007fff21337935 -[NSRunLoop(NSRunLoop) runUntilDate:] + 103
7   com.apple.UIKitCore               0x00007fff444f42fd -[UIEventFetcher threadMain] + 138
8   com.apple.Foundation              0x00007fff212a7437 __NSThread__start__ + 1068
9   libsystem_pthread.dylib           0x00007fff204278fc _pthread_start + 224
10  libsystem_pthread.dylib           0x00007fff20423443 thread_start + 15

Thread 7:
0   libsystem_pthread.dylib           0x00007fff20423420 start_wqthread + 0

Thread 8:: com.apple.NSEventThread
0   libsystem_kernel.dylib            0x00007fff203f22ba mach_msg_trap + 10
1   libsystem_kernel.dylib            0x00007fff203f262c mach_msg + 60
2   com.apple.CoreFoundation          0x00007fff20520b2f __CFRunLoopServiceMachPort + 316
3   com.apple.CoreFoundation          0x00007fff2051f20f __CFRunLoopRun + 1328
4   com.apple.CoreFoundation          0x00007fff2051e61c CFRunLoopRunSpecific + 563
5   com.apple.AppKit                  0x00007fff22eab5ca _NSEventThread + 124
6   libsystem_pthread.dylib           0x00007fff204278fc _pthread_start + 224
7   libsystem_pthread.dylib           0x00007fff20423443 thread_start + 15

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000000110b4de00  rcx: 0x00007ffeeed95fe8  rdx: 0x0000000000000000
  rdi: 0x0000000000000103  rsi: 0x0000000000000006  rbp: 0x00007ffeeed96010  rsp: 0x00007ffeeed95fe8
   r8: 0x00007ffeeed95eb0   r9: 0x0000000000000000  r10: 0x0000000000000000  r11: 0x0000000000000246
  r12: 0x0000000000000103  r13: 0x0000003000000008  r14: 0x0000000000000006  r15: 0x0000000000000016
  rip: 0x00007fff203f892e  rfl: 0x0000000000000246  cr2: 0x00007fa28b8c9000
  
Logical CPU:     0
Error Code:      0x02000148
Trap Number:     133

Hi @Enoooo ,

The Mac Catalyst versions of an app require the Keychain Sharing Entitlement to be active: during development, you can override this requirement by setting the REALM_DISABLE_METADATA_ENCRYPTION environment variable to YES

4 Likes

Hi @Paolo_Manna ,

Thank you for your support.
I will try setting the environment flag.

Best regards

Hi @Paolo_Manna ,

The user can now launch the app without any problems.

Thank you for your support.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.