首页 文章

未找到iOS构建错误'RCTPackagerClient.h'文件中的React Native Maps集成

提问于
浏览
0

在iOS中使用React Native Maps集成,得到以下'RCTPackagerClient.h'文件的构建错误,错误显示在npm模块devpods / react / core / modules中

按照github link添加'DevSupport'对我没用 .

Here is my pod file 
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'testApp' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # Pods for testApp
  rn_path = '../node_modules/react-native'
  rn_maps_path = '../node_modules/react-native-maps'
  pod "yoga", :path => "#{rn_path}/ReactCommon/yoga"
  pod 'React', path: rn_path, subspecs: [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
  ]
   # React Native third party dependencies podspecs
   pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
   pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
   # If you are using React Native <0.54, you will get the following error:
   # "The name of the given podspec `GLog` doesn't match the expected one `glog`"
   # Use the following line instead:
   #pod 'GLog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec"
   pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"

  pod 'react-native-maps', path: rn_maps_path
  pod 'react-native-google-maps', path: rn_maps_path  # Remove this line if you don't want to support GoogleMaps on iOS
  pod 'GoogleMaps'  # Remove this line if you don't want to support GoogleMaps on iOS
  pod 'Google-Maps-iOS-Utils' # Remove this line if you don't want to support GoogleMaps on iOS
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-google-maps'
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end
    if target.name == "React"
      target.remove_from_project
    end
  end

target 'testApp-tvOS' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for testApp-tvOS
end

2 回答

  • 1

    您必须在Pod文件中添加“DevSupport”才能解决问题 .

    pod'React',: path =>'../node_modules/react-native',:subspecs => ['DevSupport']

    有关更多信息,请查看以下链接:

    https://github.com/facebook/react-native/issues/17799

  • 0

    使用此podfile进行测试并相应地调整您的APP名称

    target 'YOUR_APP_NAME' do
      rn_path = '../node_modules/react-native'
      rn_maps_path = '../node_modules/react-native-maps'
      pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
      pod 'React', path: rn_path, subspecs: [
        'Core',
        'CxxBridge',
        'DevSupport',
        'RCTActionSheet',
        'RCTAnimation',
        'RCTGeolocation',
        'RCTImage',
        'RCTLinkingIOS',
        'RCTSettings',
        'RCTText',
        'RCTNetwork',
        'RCTVibration',
        'RCTWebSocket',
      ]
      pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
    
      pod 'GLog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec"
      pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"
    
      pod 'react-native-maps', path: rn_maps_path
      pod 'react-native-google-maps', path: rn_maps_path 
      pod 'GoogleMaps'  
      pod 'Google-Maps-iOS-Utils'
    
    end
    
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        if target.name == 'react-native-google-maps'
          target.build_configurations.each do |config|
            config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
          end
        end
        if target.name == "React"
          target.remove_from_project
        end
      end
    end
    

相关问题