Open DanielSRS opened 7 hours ago
react-native -v: 0.76.3 npm ls react-native-macos: react-native-macos@0.76.4 node -v: v21.7.1 npm -v: 10.5.0 yarn --version: 4.5.3 xcodebuild -version: Xcode 16.1
The app opens with a new window
The app do not open, and xcode shows that there was an error:
Can't find or decode disabled use cases An uncaught exception was raised Subclasses must implement a valid getBundleURL method ( 0 CoreFoundation 0x00000001870e4300 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x0000000186bcacd8 objc_exception_throw + 88 2 CoreFoundation 0x00000001870e41f0 +[NSException exceptionWithName:reason:userInfo:] + 0 3 AwesomeProject.debug.dylib 0x00000001060deaf0 -[RCTAppDelegate bundleURL] + 52 4 AwesomeProject.debug.dylib 0x00000001060df5d8 __42-[RCTAppDelegate createRCTRootViewFactory]_block_invoke + 44 5 AwesomeProject.debug.dylib 0x00000001060e9278 -[RCTRootViewFactory bundleURL] + 56 6 AwesomeProject.debug.dylib 0x00000001060e8b08 __38-[RCTRootViewFactory createReactHost:]_block_invoke.124 + 40 7 AwesomeProject.debug.dylib 0x00000001062518a0 -[RCTHost start] + 88 8 AwesomeProject.debug.dylib 0x00000001060e8930 -[RCTRootViewFactory createReactHost:] + 424 9 AwesomeProject.debug.dylib 0x00000001060e8700 -[RCTRootViewFactory createReactHostIfNeeded:] + 144 10 AwesomeProject.debug.dylib 0x00000001060e72bc -[RCTRootViewFactory viewWithModuleName:initialProperties:launchOptions:] + 280 11 AwesomeProject.debug.dylib 0x00000001060de050 -[RCTAppDelegate loadReactNativeWindow:] + 176 12 AwesomeProject.debug.dylib 0x00000001060ddf2c -[RCTAppDelegate applicationDidFinishLaunching:] + 620 13 AwesomeProject.debug.dylib 0x0000000105bd3e30 -[AppDelegate applicationDidFinishLaunching:] + 128 14 CoreFoundation 0x0000000187066800 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148 15 CoreFoundation 0x00000001870f766c ___CFXRegistrationPost_block_invoke + 88 16 CoreFoundation 0x00000001870f75b4 _CFXRegistrationPost + 436 17 CoreFoundation 0x000000018703543c _CFXNotificationPost + 732 18 Foundation 0x00000001881ddb14 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88 19 AppKit 0x000000018aba4614 -[NSApplication _postDidFinishNotification] + 284 20 AppKit 0x000000018aba43c4 -[NSApplication _sendFinishLaunchingNotification] + 172 21 AppKit 0x000000018aba2824 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 500 22 AppKit 0x000000018aba242c -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 488 23 Foundation 0x000000018820679c -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 316 24 Foundation 0x0000000188206594 _NSAppleEventManagerGenericHandler + 80 25 AE 0x000000018e554134 _AppleEventsCheckInAppWithBlock + 13904 26 AE 0x000000018e553a58 _AppleEventsCheckInAppWithBlock + 12148 27 AE 0x000000018e54cfa4 aeProcessAppleEvent + 488 28 HIToolbox 0x00000001923fdc4c AEProcessAppleEvent + 68 29 AppKit 0x000000018ab9bd00 _DPSNextEvent + 1420 30 AppKit 0x000000018b4dbe0c -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688 31 AppKit 0x000000018ab8eae0 -[NSApplication run] + 480 32 AppKit 0x000000018ab65364 NSApplicationMain + 888 33 AwesomeProject.debug.dylib 0x0000000105bd3da4 __debug_main_executable_dylib_entry_point + 36 34 dyld 0x0000000186c08274 start + 2840 ) FAULT: RCTAppDelegate::bundleURL not implemented: Subclasses must implement a valid getBundleURL method; (user info absent) NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
No response
Just documenting for anyone on v0.74. When generating a fresh react-native-macos@0.74.15 app, the following error will be raised on startup: RCTAppDelegate::bundleURL not implemented Subclasses must implement a valid getBundleURL method It can be fixed, as suggested above, by applying the following patch to AppDelegate.mm: - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { - #if DEBUG - return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; - #else - return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; - #endif + return [self bundleURL]; } + + - (NSURL *)bundleURL + { + #if DEBUG + return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; + #else + return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; + #endif + }
Just documenting for anyone on v0.74. When generating a fresh react-native-macos@0.74.15 app, the following error will be raised on startup:
react-native-macos@0.74.15
RCTAppDelegate::bundleURL not implemented Subclasses must implement a valid getBundleURL method
It can be fixed, as suggested above, by applying the following patch to AppDelegate.mm:
AppDelegate.mm
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { - #if DEBUG - return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; - #else - return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; - #endif + return [self bundleURL]; } + + - (NSURL *)bundleURL + { + #if DEBUG + return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; + #else + return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; + #endif + }
Originally posted by @shirakaba in #2164
Thanks for the report and fix! Any chance you'd be willing to submit a PR for this? Otherwise I'll try to get to it next week.
Sure! just opened #2309
Environment
Steps to reproduce the bug
Expected Behavior
The app opens with a new window
Actual Behavior
The app do not open, and xcode shows that there was an error:
Reproducible Demo
No response
Additional context
I as able to fix it with a patch suggested in an older issue:
Originally posted by @shirakaba in #2164
With these changes the app builds and opens successfully