Chamitha Narawita
Chamitha Narawita

Reputation: 63

iOS fails to run on version 0.73.1, 'react/debug/react_native_assert.h' file not found on RunLoopObserver

enter image description here

I get the error: 'react/debug/react_native_assert.h' file not found, React-utils/RunLoopObserver. any help is appreciated.

Here is my pod file

require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'
pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
pod 'ffmpeg-kit-react-native', :subspecs => ['min-gpl-lts'], :podspec => '../node_modules/ffmpeg-kit-react-native/ffmpeg-kit-react-native.podspec'

permissions_path = '../node_modules/react-native-permissions/ios'

pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"

flipper_config = FlipperConfiguration.disabled

linkage = ENV['USE_FRAMEWORKS']

abstract_target 'CommonPods' do
  config = use_native_modules!
  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true
  pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios'

  use_react_native!(
    :path => config[:reactNativePath],
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    
     installer.pods_project.targets.each do |target|
       target.build_configurations.each do |config|
         config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
         config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
         if ["React-cxxreact", "React-NativeModulesApple", "RNGestureHandler", "RNScreens", "React-utils", "React-debug", "React-runtimescheduler"].any? { |t| t == target.name }
           append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon")
         end
       end
     end
   end

    def append_header_search_path(target, path)
        target.build_configurations.each do |config|
            config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
            config.build_settings["HEADER_SEARCH_PATHS"] << path
        end
    end

    pod 'Firebase'
    pod 'FirebaseCore'
    pod 'FirebaseCoreInternal'
    pod 'FirebaseCoreExtension'
    pod 'FirebaseInstallations'
    pod 'FirebaseABTesting'
    pod 'FirebaseFirestoreInternal'

    pod 'GoogleUtilities'
    pod 'GoogleDataTransport'
    pod 'nanopb'

    target 'Dev' do
    end

    target 'QA' do
    end
end

HERE IS THE RN-INFO

System: OS: macOS 14.1 CPU: (10) arm64 Apple M1 Pro Memory: 78.05 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.5.1 path: /opt/homebrew/bin/node Yarn: version: 1.22.18 path: /opt/homebrew/bin/yarn npm: version: 9.8.0 path: /opt/homebrew/bin/npm Watchman: version: 2023.08.14.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.3 path: /opt/homebrew/opt/ruby/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.0 - iOS 17.0 - macOS 14.0 - tvOS 17.0 - watchOS 10.0 Android SDK: API Levels: - "28" - "29" - "30" - "31" - "32" - "33" Build Tools: - 29.0.2 - 30.0.2 - 30.0.3 - 31.0.0 - 32.0.0 - 32.1.0 - 33.0.0 - 33.0.2 System Images: - android-32 | Google APIs ARM 64 v8a - android-32 | Google APIs Intel x86 Atom_64 - android-33 | Google APIs ARM 64 v8a Android NDK: 22.1.7171670 IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10811636 Xcode: version: 15.0/15A240d path: /usr/bin/xcodebuild Languages: Java: version: 1.8.0_292 path: /usr/bin/javac Ruby: version: 3.2.2 path: /opt/homebrew/opt/ruby/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: Not Found react-native: Not Found react-native-macos: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false

Upvotes: 1

Views: 2017

Answers (1)

Issue Reason : this issue came when we trying to install pod but we written something code in podfile then podfiles runs successfully but the issue came when we trying to build in xcode then there this issue highlight that the file which is not there or file is there but xcode will not get that file while building your app for that reason it will throw an error.

Solution 1 : Firstly, make sure you delete your pod file & podfile.lock. Then, reinstall it using either arch -x86_64 pod install or pod install, depending on your machine's architecture.

If you are using a Mac with an M1 chip, you might need to run sudo arch -x86_64 gem install ffi before you can install your dependencies. This is because the M1 chip uses a different machine architecture than the older Intel-based Macs.

After installing the dependencies, make sure to open the .xcworkspace file instead of the .xcodeproj file, as CocoaPods creates a workspace that includes both your project and the installed dependencies.

Lastly, if you are unsure about your machine's architecture, you can check it by running the uname -m command in the terminal.

command summary:
1) For M1 chip-based Macs:
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install

2) For Intel-based Macs:
pod install

Solution 2 : Check to make sure react_native_assert.h is on the right route. The error can arise because Xcode cannot find the file. To validate the correct path, open your project in Xcode and browse to YourProject > Build Settings > Header Search Paths. Ensure that the path to react_native_assert.h is accurate.

You must add the React Native project as a subproject to your main project if you are using a library that requires React Native. Here's how to accomplish it:

To access the project settings in Xcode, click YourProjectName at the top of the project navigator.
Click the + button when you reach the "Embedded Binaries" section by scrolling down.
Select "Add Other" and open your React Native project's ios folder. Choose the file React.xcodeproj.
Now you should see the React.xcodeproj file in your project navigator. Expand it and find the libReact.a file under "Products".
Once more, click the Add button next to "Embedded Binaries" and choose libReact.a from the list.
In Xcode, use Product > Clean Build Folder to clean your build.
Try constructing your project again.

Solution 3 : Do this changes in your podfile see if it works

post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )

    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        if ["React-cxxreact", "React-utils", "React-NativeModulesApple"].any? { |t| t == target.name }
          config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
          config.build_settings["HEADER_SEARCH_PATHS"] << "${PODS_ROOT}/../../node_modules/react-native/ReactCommon"
        end
      end
    end
  end

Upvotes: 0

Related Questions