Search code examples
iosreact-nativegoogle-maps

'GoogleMaps/GoogleMaps.h' file not found in Google-Maps-iOS-Utils


I am currently using React Native. I managed to float Google Maps on Android using the react-native-maps library, but when I try to build through xcode on ios, I get the following error.

enter image description here

And Here is my Podfile.

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, '14.0'
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
 use_frameworks! :linkage => linkage.to_sym
end

target 'ParkingControlApp' do
  use_modular_headers!
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-maps', path: rn_maps_path
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/googlemaps/google-maps-ios-utils'
  
  use_native_modules!
  
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

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

  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
    )
  end
end

I'd appreciate it if you could tell me how to solve it!


Solution

  • first of all remove your node-modules , Pods , Podfile.lock and drivedData

    now add this package in your package.json "react-native-maps": "^0.28.0" and replace your all these pods:

     rn_maps_path = '../node_modules/react-native-maps'
      pod 'react-native-maps', path: rn_maps_path
      pod 'react-native-google-maps', :path => rn_maps_path
      pod 'GoogleMaps'
      pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/googlemaps/google-maps-ios-utils'
      
    

    with

    pod 'GoogleMaps', '3.9.0'
    

    now install all dependencies using yarn or npm then update pod repo:

    pod install --repo-update

    it will install all required dependencies for GoogleMaps automatically.

    Now run application through xcode, hope it will help you.