ryanmcgrath / cacao

Rust bindings for AppKit (macOS) and UIKit (iOS/tvOS). Experimental, but working!
MIT License
1.79k stars 65 forks source link

[UISceneConfiguration isEqualToString:]: unrecognized selector error with 0.4.0-beta1 #86

Closed Miha-Rozina closed 1 year ago

Miha-Rozina commented 1 year ago

After updating to the latest Cacao version (0.4.0-beta1) I get the following runtime error:

2023-06-09 08:43:58.534893+0200 viewer-rs-ios[87147:28872615] [Assert] BUG IN CLIENT OF UIKIT: Attempting to define a mismatched UISceneSessionRole! This will be an assert in future UIKit releases! Assigning a UISceneConfiguration with role "UIWindowSceneSessionRoleApplication" for a UISceneSession with role "<UISceneConfiguration: 0x600002ecd000; name: 0x0>".
2023-06-09 08:43:58.535361+0200 viewer-rs-ios[87147:28872615] -[UISceneConfiguration isEqualToString:]: unrecognized selector sent to instance 0x600002ecd000
2023-06-09 08:43:58.538850+0200 viewer-rs-ios[87147:28872615] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UISceneConfiguration isEqualToString:]: unrecognized selector sent to instance 0x600002ecd000'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000190e7f19c __exceptionPreprocess + 176
    1   libobjc.A.dylib                     0x000000019099e4d4 objc_exception_throw + 60
    2   CoreFoundation                      0x0000000190f26178 -[NSObject(NSObject) __retain_OA] + 0
    3   CoreFoundation                      0x0000000190de7150 ___forwarding___ + 1600
    4   CoreFoundation                      0x0000000190de6a50 _CF_forwarding_prep_0 + 96
    5   UIKitCore                           0x00000001bd201470 -[UIWindowScene _allowsEventUIWindowRouting] + 76
    6   UIKitCore                           0x00000001bc766cdc -[UIScene _updateTargetOfKeyboardEventDeferringEnvironment] + 52
    7   UIKitCore                           0x00000001bc4ff05c -[UIScene initWithSession:connectionOptions:] + 1340
    8   UIKitCore                           0x00000001bc4fe7d0 -[UIWindowScene initWithSession:connectionOptions:] + 92
    9   UIKitCore                           0x00000001bc4fde7c +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 416
    10  UIKitCore                           0x00000001bc4fcab4 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 884
    11  UIKitCore                           0x00000001bc4fbd8c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 372
    12  UIKitCore                           0x00000001bc4fbba0 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 288
    13  FrontBoardServices                  0x00000001a51cb0bc -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 372
    14  FrontBoardServices                  0x00000001a51eea30 __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.102 + 120
    15  FrontBoardServices                  0x00000001a51b9cd0 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 196
    16  FrontBoardServices                  0x00000001a51ee664 __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke + 356
    17  libdispatch.dylib                   0x00000001053aa99c _dispatch_client_callout + 20
    18  libdispatch.dylib                   0x00000001053aed70 _dispatch_block_invoke_direct + 388
    19  FrontBoardServices                  0x00000001a51b9be4 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 48
    20  FrontBoardServices                  0x00000001a5209060 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 220
    21  FrontBoardServices                  0x00000001a51b9b84 -[FBSSerialQueue _performNextFromRunLoopSource] + 28
    22  CoreFoundation                      0x0000000190e06710 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
    23  CoreFoundation                      0x0000000190e066a4 __CFRunLoopDoSource0 + 176
    24  CoreFoundation                      0x0000000190e06414 __CFRunLoopDoSources0 + 244
    25  CoreFoundation                      0x0000000190e0501c __CFRunLoopRun + 828
    26  CoreFoundation                      0x0000000190e0458c CFRunLoopRunSpecific + 612
    27  HIToolbox                           0x000000019a639df4 RunCurrentEventLoopInMode + 292
    28  HIToolbox                           0x000000019a639c30 ReceiveNextEventCommon + 648
    29  HIToolbox                           0x000000019a639988 _BlockUntilNextEventMatchingListInModeWithFilter + 76
    30  AppKit                              0x0000000194023f58 _DPSNextEvent + 636
    31  AppKit                              0x00000001940230f4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
    32  AppKit                              0x0000000194017558 -[NSApplication run] + 464
    33  AppKit                              0x0000000193fee9a8 NSApplicationMain + 880
    34  AppKit                              0x00000001942470ec +[NSWindow _savedFrameFromString:] + 0
    35  UIKitMacHelper                      0x00000001a8434b08 UINSApplicationMain + 988
    36  UIKitCore                           0x00000001bc4e3fdc UIApplicationMain + 148
    37  viewer-rs-ios                       0x000000010430b7f8 _ZN5cacao5uikit3app20App$LT$T$C$W$C$F$GT$3run17h291a1bb9f07402c9E + 512
    38  viewer-rs-ios                       0x0000000104330bc4 _ZN5storm10standalone8platform3ios12execute_impl17hf160a36e57c1f169E + 156
    39  viewer-rs-ios                       0x000000010433d7e0 run_app + 32
    40  viewer-rs-ios                       0x00000001042fd10c main + 24
    41  dyld                                0x00000001909cff28 start + 2236
)

I have no issue when I use Cacao commit 64908e5.

ryanmcgrath commented 1 year ago

Can you provide more information about how you're triggering/encountering this?

That doesn't show when I run the ios-beta example, so I'm guessing you may be in somewhat uncharted territory. We can definitely look at fixing it tho.

Miha-Rozina commented 1 year ago

I tried to make it reproducible and after cloning Cacao and using it, it started working. I've then used the official release and it works as well. So there might have been some build artefacts have been cached and I didn't realise it. So after a full clean build it seems to be working fine.

Thanks again for making a new release!

ryanmcgrath commented 1 year ago

Ha, happens to the best of us. Glad it's working though!

Definitely curious as to what you built. :)

Miha-Rozina commented 1 year ago

Just using Cacao to start up an iOS application and initialise a UIView to later draw into the surface using Metal API. So not much more than your example does I am afraid. But its great to not have to touch Objective C and have a pure Rust codebase, so I am very grateful for all your work! :)