ios 从现有的react native项目构建的xcode会产生大量错误

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

我已经花了一周的时间尝试在ios上构建我的react-native项目。昨天我能够构建它,但我的权限有问题,所以我开始按照它的说明并改变了很多东西。但现在我有很多错误显示。似乎我做了一个很大的改变/错误,打破了一切。现在我有这样的错误:“无法生成模块'React'”

编辑这里是我的pod文件:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'

install! 'cocoapods', :deterministic_uuids => false

use_frameworks!

# Convert all permission pods into static libraries
pre_install do |installer|
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

  installer.pod_targets.each do |pod|
    if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
      def pod.build_type;
        # Uncomment the line corresponding to your CocoaPods version
        Pod::BuildType.static_library # >= 1.9
        # Pod::Target::BuildType.static_library # < 1.9
      end
    end
  end
end

target 'HappySunnyHourFront' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'react-native-camera', :path => '../node_modules/react-native-camera'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
  pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseAuth'
  pod 'FirebaseFirestore'

  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  target 'HappySunnyHourFrontTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  # use_flipper!()

  post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES"] = true
    end
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

对于运行脚本:它在我的剧目里看起来不一样:

hts6caw3

hts6caw31#

在post_install do中更新以下代码|安装程序|在Podfile中循环

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES"] = true
      __apply_Xcode_12_5_M1_post_install_workaround(installer)
    end
  end
 end
end


此问题可能是由于脚本文件Pods-resources.sh检查运行脚本的路径不正确而导致的。
check kishoretheju answer for run script incorrect path

相关问题