在找不到iOS构建错误“RCTPackagerClient.h”文件中的React Native Maps集成

时间:2018-06-13 09:25:08

标签: ios react-native react-native-ios

在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 个答案:

答案 0 :(得分:1)

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

  

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

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

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

答案 1 :(得分: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