Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing release 0.74.1: multiple errors when creating a new project #2164

Closed
morukutsu opened this issue Aug 15, 2024 · 6 comments
Closed

Testing release 0.74.1: multiple errors when creating a new project #2164

morukutsu opened this issue Aug 15, 2024 · 6 comments
Labels
bug Something isn't working Needs: Triage 🔍

Comments

@morukutsu
Copy link

morukutsu commented Aug 15, 2024

Environment

react-native -v: 0.74.1
npm ls react-native-macos: 0.74.1
node -v: v22.6.0
npm -v: 10.8.2
yarn --version: 1.22.22
xcodebuild -version: Xcode 15.4 Build version 15F31d

Steps to reproduce the bug

Hello. I am testing the new release 0.74.1 with a clean project.

Test sequence:

# Install RN
npx react-native@latest init test_project --version 0.74.1
npx react-native-macos-init --version 0.74.1

The second command will fail with the same error as #2152.
Afaik, this one should have been fixed with a fix to react-native-macos-init.
Should be the package be updated on NPM as well? (see https://www.npmjs.com/package/react-native-macos-init?activeTab=versions)

# Previous command failed, to workaround:
yarn add "[email protected]"

# And rerun to proceed
npx react-native-macos-init --version 0.74.1

Then it fails with another error:

Couldn't install Pods. Updating the Pods project and trying again...
Command `pod install` failed.
└─ Cause: Invalid `Podfile` file: uninitialized constant Pod::Podfile::FlipperConfiguration.

 #  from /Users/moru/Documents/Work/test_project/macos/Podfile:18
 #  -------------------------------------------
 #      # Flipper is not compatible w/ macOS
 >      :flipper_configuration => FlipperConfiguration.disabled,
 #      # An absolute path to your application root.
 #  -------------------------------------------

Commenting the line ":flipper_configuration => FlipperConfiguration.disabled" in the podfile will allow the build to proceed. However, on my end running npx react-native run-macos then does not open the app. It seems there's at least an issue with the podfile, but atm I don't have a good enough understanding of the system to debug it.

Thank you!

Expected Behavior

No response

Actual Behavior

No response

Reproducible Demo

No response

Additional context

No response

@Saadnajmi
Copy link
Collaborator

Indeed, :flipper_configuration was removed, so I think if that's still showing up in our template project, we need to remove it.

@morukutsu
Copy link
Author

I had a look at https://github.com/microsoft/react-native-macos/blob/main/packages/rn-tester/Podfile to fix the Podfile, as it has been updated fairly recently.

However, even after removing :flipper_configuration and getting a successful build, when running npx react-native run-macos, nothing happens.

test_project % npx react-native run-macos

  WARNING: You should run npx react-native@latest to ensure you're always using the most current version of the CLI. NPX has cached version (0.74.1) != current release (0.75.1)

warn Argument --configuration has been deprecated and will be removed in a future release, please use --mode instead.
info Found Xcode workspace "test_project.xcworkspace"
info Building (using "xcodebuild -workspace test_project.xcworkspace -configuration Debug -scheme test_project-macOS")
(node:82100) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
........................................
2024-08-17 14:41:34.864 xcodebuild[82150:2765339]  DVTPlugInQuery: Requested but did not find extension point with identifier 'Xcode.InterfaceBuilderBuildSupport.PlatformDefinition'. This is programmer error; code should only request extension points that are defined by itself or its dependencies.
info Launching app "org.reactjs.native.test-project" from "/Users/moru/Library/Developer/Xcode/DerivedData/test_project-gxmjruklmbhydfapvfduwvvevpsy/Build/Products/Debug/test_project.app"
success Successfully launched the app

image

The app opens, there is a toolbar but no window. The previous version does work, with similar steps.

Thank you!

@hsjoberg
Copy link

@morukutsu I think the problem is that bundleURL func is not defined in AppDelegate.mm.

Taken from https://react-native-community.github.io/upgrade-helper/?from=0.73.9&to=0.74.5#RnDiffApp-ios-RnDiffApp-AppDelegate.mm:

- (NSURL *)bundleURL
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

Here's the error I got from Xcode.

An uncaught exception was raised
Subclasses must implement a valid getBundleURL method
(
	0   CoreFoundation                      0x000000018e82f2ec __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x000000018e316788 objc_exception_throw + 60
	2   CoreFoundation                      0x000000018e82f1dc +[NSException exceptionWithName:reason:userInfo:] + 0
	3   rnmacos74                           0x000000010343477c -[RCTAppDelegate bundleURL] + 52
    [...]

@kaiyes
Copy link

kaiyes commented Sep 24, 2024

Looks like this is still happening in rn-macos 75.2 & 75.3 & 75.4 with react native 75.3
Screenshot 2024-09-24 at 11 51 48 PM

@Saadnajmi
Copy link
Collaborator

@kaiyes should be fixed now

@shirakaba
Copy link

Just documenting for anyone on v0.74. When generating a fresh [email protected] 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
+ }

shirakaba added a commit to shirakaba/react-native-safe-area-context that referenced this issue Oct 30, 2024
shirakaba added a commit to shirakaba/react-native-safe-area-context that referenced this issue Oct 30, 2024
janicduplessis pushed a commit to th3rdwave/react-native-safe-area-context that referenced this issue Oct 31, 2024
* Move example -> example-prev

* Init React Native Test App

yarn init-test-app --version 0.73.0
(and manually bump react-native-* versions afterwards)

* Merge example-prev into example

* Add osx to podspec

* Fix metro config to resolve react-native-safe-area-context

* Install pods

* Write macOS equivalents for all iOS code

* Raise macOS deployment target to 10.15

* Delete example-prev

* Trying and failing to get macOS app to build

* Apply Tommy Nguyen's suggestions to fix pod installation

Co-authored-by: Tommy Nguyen <[email protected]>

* Stop using compat components for macOS

* Restore example to its original state

* Add example-macos

* Reduce macOS deployment target to 10.15

* Make example-macos use RNTesterApp instead of bespoke app

* Remove example-macos

* Pin react-native and react-native-macos to v0.74

* Init [email protected] project

I temporarily renamed the "name" field in package.json to "RNSACExample", then ran `npx react-native-macos-init` to generate a project by that name.

* Fix bundleURL

microsoft/react-native-macos#2164 (comment)

* Fix Metro config

* Run yarn format:write

---------

Co-authored-by: Tommy Nguyen <[email protected]>
shirakaba added a commit to shirakaba/fiddle-template that referenced this issue Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Needs: Triage 🔍
Projects
None yet
Development

No branches or pull requests

5 participants