iOS无法在0.73.1版上运行,RunLoopObserver上未找到“react/debug/react_native_assert. h”文件

d4so4syb  于 12个月前  发布在  iOS
关注(0)|答案(1)|浏览(197)

x1c 0d1x的数据
我得到错误:'react/debug/react_native_assert. h'文件未找到,React-utils/RunLoopObserver。

这是我的pod文件

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

字符串
这里是RN-INFO
系统名称:操作系统:macOS 14.1 CPU:(10)arm 64苹果M1 Pro内存:78.05 MB / 16.00 GB shell :版本:“5.9”路径:/bin/zsh二进制文件:Node:版本:20.5.1路径:/opt/homebrew/bin/node Yarn:版本:1.22.18路径:/opt/homebrew/bin/yarn npm:版本:9.8.0路径:/opt/homebrew/bin/npm Watchman:版本:2023.08.14.00路径:/opt/homebrew/bin/watchman管理器:CocoaPods:版本:1.14.3路径:/opt/homebrew/opt/ruby/bin/pod SDK:iOS SDK:平台:- DriverKit 23.0 - iOS 17.0 - macOS 14.0 - tvOS 17.0 - watchOS 10.0 Android SDK:API级别:- “28”-“29”-“30”-“31”-“32”-“33”构建工具:- 29.0.2 - 30.0.2 - 30.0.3 - 31.0.0 - 32.0.0 - 32.1.0 - 33.0.0 - 33.0.2系统镜像:- android-32| Google API ARM 64 v8a - android-32| Google API Intel x86 Atom_64 - android-33| Google API ARM 64 v8a Android NDK:22.1.7171670 IDE:Android Studio:2022.3 AI-223.8836.35.2231.10811636 Xcode:version:15.0/15A240d path:/usr/bin/xcodebuild语言: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/js”: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

hmtdttj4

hmtdttj41#

问题原因:这个问题来了,当我们试图安装pod,但我们写的东西代码在podfile然后podfiles运行成功,但问题来了,当我们试图建立在xcode然后有这个问题突出表明,该文件不存在或文件是存在的,但xcode将不会得到该文件,而建立您的应用程序,因为这个原因,它会抛出一个错误.
方案一:首先,确保删除你的pod文件& podfile. lock。然后,使用arch-x86_64 pod install或pod install重新安装它,这取决于你的机器的架构。

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

字符串
方案二:检查以确保react_native_assert. h在正确的路由上。错误可能是因为Xcode找不到文件。要验证正确的路径,请在Xcode中打开您的项目,然后浏览到YourProject > Build Settings > Header Search Paths。确保react_native_assert. h的路径准确。

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.


解决方案3:在你的podfile中做这些更改,看看是否有效

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

相关问题