提问者:小点点

升级react-native(0.60)后,我面临React/{任何文件名}. h'文件未找到错误与不同的包


无法构建应用程序,我收到导入文件未找到错误与不同的包

所以我尝试了导入“{任何文件名}. h”

但我一再面临react-native-line-渐变,快速图像,webview等错误

  • 在这里,我试图删除node_modules,然后npm安装并再次重建应用程序。它失败了
  • 清理项目并删除派生数据。这也不起作用
  • 还删除了Pod和Podfile. lock,然后清理并运行pod install。什么都没用。

❌ node_modules/react-native-fast-image/ios/FastImage/FFFastImageViewManager. h:1:9:'React/RCTViewManager.h'文件未找到

❌ node_modules/react-native-fast-image/ios/FastImage/RCTConvertFFFastImage. h:1:9:'React/RCTConversion.h'文件未找到

^~~~~~~~~~~~~~~~~~~~

React/RCTViewManager. h'文件未找到(这是由于线性渐变)包)


共1个答案

匿名用户

我个人在Podeile中添加了一点代码来解决标题搜索路径问题,因为你在这里遇到了它

  post_install do |installer|
    puts 'post_install'
    app_project = Xcodeproj::Project.open("./X.xcodeproj")
    output = `find .. -name "*.xcodeproj"`
    p output
    output.split("\n").each do |projectPath|
      app_project = Xcodeproj::Project.open(projectPath)
      app_project.native_targets.each do |target|
        target.build_configurations.each do |config|
          if !config.build_settings['HEADER_SEARCH_PATHS']
            config.build_settings['HEADER_SEARCH_PATHS'] ||= []
          end
          config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/Pods/Headers/**'
          config.build_settings['HEADER_SEARCH_PATHS'] <<' $(SRCROOT)/../../../../ios/Pods/Headers/**'
          config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/../../../ios/Pods/Headers/**'
          config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/../../ios/Pods/Headers/**'
          config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/../ios/Pods/Headers/**'
          app_project.save
        end
      end  
    end
    puts 'post_install DONE'
  end

我希望我能帮上忙