react-native-maps icon indicating copy to clipboard operation
react-native-maps copied to clipboard

'RCTConvert+AirMap.h' file not found

Open WASHSWATDAVID opened this issue 6 years ago • 32 comments

Bug report

Summary

Environment info

react-native info output:

System:
    OS: macOS 10.15.6
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 50.64 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 8.8.1 - ~/.nvm/versions/node/v8.8.1/bin/node
    Yarn: 1.12.1 - /usr/local/bin/yarn
    npm: 5.4.2 - ~/.nvm/versions/node/v8.8.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.1, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.1 AI-173.4907809
    Xcode: 12.1/12A7403 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_181 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: ^4.13.0 => 4.13.0 
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

My Xcode version 12.1 (12A7403) "react-native-maps": "0.27.1",

Podfile

  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

Steps to reproduce

When I build my ios project always shown 'RCTConvert+AirMap.h' file not found message

Screen Shot 2020-10-30 at 4 25 46 AM

WASHSWATDAVID avatar Oct 29 '20 19:10 WASHSWATDAVID

Hi @WASHSWATDAVID This might help #1193 or #3390

JavyMB avatar Oct 30 '20 15:10 JavyMB

Have you find a solution? I'm facing the same problem

matheusmurbi avatar Nov 27 '20 19:11 matheusmurbi

Have you find a solution? I'm facing the same problem

try add below code to your ios/Podfile even your RN is higher then 0.59

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

https://github.com/react-native-maps/react-native-maps/blob/master/docs/installation.md#using-cocoapods-react-native-059-and-lower

fungland avatar Dec 15 '20 03:12 fungland

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 13 '21 03:02 stale[bot]

I'm also having this issue with a fresh react native project using typescript template. react 17.0.1 react-native 0.64.1 react-native-maps 0.28.0 . I'm searching for a solution but if I can't find one I'm hoping someone can post one here.

ryansaam avatar Jul 19 '21 08:07 ryansaam

I don't know why it no longer says this in the installation instructions but I've seen it on YouTube of people installing older versions on this library and the instruction use to say to put pod 'GoogleMaps' in your pod file.

my pod file now looks like:

target 'MyApp' do
  # react-native-maps
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  # end

  ...

This fixed it for me, hope it helps people in the future.

ryansaam avatar Jul 19 '21 09:07 ryansaam

I don't know why it no longer says this in the installation instructions but I've seen it on YouTube of people installing older versions on this library and the instruction use to say to put pod 'GoogleMaps' in your pod file.

my pod file now looks like:

target 'MyApp' do
  # react-native-maps
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  # end

  ...

This fixed it for me, hope it helps people in the future.

This one not work for me, in case i am using use_framework! in my podfile. I also try this instruction: https://github.com/googlemaps/google-maps-ios-utils/blob/b721e95a500d0c9a4fd93738e83fc86c2a57ac89/Swift.md but does not work! Anyone have a full guide to install react-native-maps with use_framework!. I tried all the tutorials on the internet but none of them really worked

JustineUIT avatar Jul 22 '21 07:07 JustineUIT

Dear @JustineUIT, I hope it's not too late. I'm putting here a fully working Podfile example. Hope also helps who ended up with this discussion further. A briefly key thing to know is the setting pre-installer section in Podfile and marking whole build failing libraries as Static, let's see in example:

# Override Firebase SDK Version
$FirebaseSDKVersion = '8.9.0'

platform :ios, '12.1'

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

# **linkage static is important**
use_frameworks! :linkage => :static
target 'myApp' do
  $static_framework = []
  rn_maps_path = '../node_modules/react-native-maps'

  config = use_native_modules!
  use_react_native!(path: config['reactNativePath'], :hermes_enabled => true)


  # **AUTHOR NOTE:** I didn't try to fix with flipper, we don't want to use anyway. 
       Anybody they would like to try more than welcome
  #  if !ENV['IS_CI']
  #    use_flipper!({
  #      'Flipper' => flipperkit_version,
  #      'Flipper-Folly' => '2.6.10',
  #      'Flipper-DoubleConversion' => '3.2.0',
  #      'Flipper-Glog' => '0.5.0.3',
  #      'Flipper-PeerTalk' => '0.0.4',
  #      'OpenSSL-Universal' => '1.1.1100'
  #    })
  #  end

  # This is the whole magic starts
  # Hit build times and times and which library ever failing add here
  $static_framework += [
    'react-native-maps',
    'react-native-google-maps',
    'Google-Maps-iOS-Utils',
    'GoogleMaps',
    'RNPermissions',
    'Permission-LocationWhenInUse',
    'Permission-Notifications',
    'react-native-paste-input',
    'vision-camera-code-scanner',
    'VisionCamera'
  ]

  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

  pod 'RNSentry', :path => '../node_modules/@sentry/react-native'

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"

  # This library was the reason we start using use_frameworks! at the beginning
  pod 'RealmSwift', '~>10'
end

target 'OneSignalExtension' do
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
  pod 'SwiftyJSON'
end

# ****** THIS IS THE MAGIC ******
pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
        installer.pod_targets.each do |pod|
            if $static_framework.include?(pod.name)
                def pod.build_type;
                Pod::BuildType.static_library # >= 1.9
            end
        end
    end
end

post_install do |installer|
  #  if !ENV['IS_CI']
  #    flipper_post_install(installer)
  #  end

 # This is also important AND MUST BE IN SAME ORDER
  react_native_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'RCT-Folly'
      target.build_configurations.each do |config|
        config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
      end
    end
  end
  #   __apply_Xcode_12_5_M1_post_install_workaround(installer)
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Pro tip: after applying this and find all the libraries they needs static library change. Remove Pods one last time and remove DerivedData too

yadigar-prospr avatar Jun 28 '22 11:06 yadigar-prospr

Dear @JustineUIT, I hope it's not too late. I'm putting here a fully working Podfile example. Hope also helps who ended up with this discussion further. A briefly key thing to know is the setting pre-installer section in Podfile and marking whole build failing libraries as Static, let's see in example:

# Override Firebase SDK Version
$FirebaseSDKVersion = '8.9.0'

platform :ios, '12.1'

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

# **linkage static is important**
use_frameworks! :linkage => :static
target 'myApp' do
  $static_framework = []
  rn_maps_path = '../node_modules/react-native-maps'

  config = use_native_modules!
  use_react_native!(path: config['reactNativePath'], :hermes_enabled => true)


  # **AUTHOR NOTE:** I didn't try to fix with flipper, we don't want to use anyway. 
       Anybody they would like to try more than welcome
  #  if !ENV['IS_CI']
  #    use_flipper!({
  #      'Flipper' => flipperkit_version,
  #      'Flipper-Folly' => '2.6.10',
  #      'Flipper-DoubleConversion' => '3.2.0',
  #      'Flipper-Glog' => '0.5.0.3',
  #      'Flipper-PeerTalk' => '0.0.4',
  #      'OpenSSL-Universal' => '1.1.1100'
  #    })
  #  end

  # This is the whole magic starts
  # Hit build times and times and which library ever failing add here
  $static_framework += [
    'react-native-maps',
    'react-native-google-maps',
    'Google-Maps-iOS-Utils',
    'GoogleMaps',
    'RNPermissions',
    'Permission-LocationWhenInUse',
    'Permission-Notifications',
    'react-native-paste-input',
    'vision-camera-code-scanner',
    'VisionCamera'
  ]

  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

  pod 'RNSentry', :path => '../node_modules/@sentry/react-native'

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"

  # This library was the reason we start using use_frameworks! at the beginning
  pod 'RealmSwift', '~>10'
end

target 'OneSignalExtension' do
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
  pod 'SwiftyJSON'
end

# ****** THIS IS THE MAGIC ******
pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
        installer.pod_targets.each do |pod|
            if $static_framework.include?(pod.name)
                def pod.build_type;
                Pod::BuildType.static_library # >= 1.9
            end
        end
    end
end

post_install do |installer|
  #  if !ENV['IS_CI']
  #    flipper_post_install(installer)
  #  end

 # This is also important AND MUST BE IN SAME ORDER
  react_native_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'RCT-Folly'
      target.build_configurations.each do |config|
        config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
      end
    end
  end
  #   __apply_Xcode_12_5_M1_post_install_workaround(installer)
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Pro tip: after applying this and find all the libraries they needs static library change. Remove Pods one last time and remove DerivedData too

Thanks you, work like a charm!

TheBlackHacker avatar Jul 07 '22 12:07 TheBlackHacker

config

Works Great!

riddy6421 avatar Jul 21 '22 12:07 riddy6421

Dear @JustineUIT, I hope it's not too late. I'm putting here a fully working Podfile example. Hope also helps who ended up with this discussion further. A briefly key thing to know is the setting pre-installer section in Podfile and marking whole build failing libraries as Static, let's see in example:

# Override Firebase SDK Version
$FirebaseSDKVersion = '8.9.0'

platform :ios, '12.1'

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

# **linkage static is important**
use_frameworks! :linkage => :static
target 'myApp' do
  $static_framework = []
  rn_maps_path = '../node_modules/react-native-maps'

  config = use_native_modules!
  use_react_native!(path: config['reactNativePath'], :hermes_enabled => true)


  # **AUTHOR NOTE:** I didn't try to fix with flipper, we don't want to use anyway. 
       Anybody they would like to try more than welcome
  #  if !ENV['IS_CI']
  #    use_flipper!({
  #      'Flipper' => flipperkit_version,
  #      'Flipper-Folly' => '2.6.10',
  #      'Flipper-DoubleConversion' => '3.2.0',
  #      'Flipper-Glog' => '0.5.0.3',
  #      'Flipper-PeerTalk' => '0.0.4',
  #      'OpenSSL-Universal' => '1.1.1100'
  #    })
  #  end

  # This is the whole magic starts
  # Hit build times and times and which library ever failing add here
  $static_framework += [
    'react-native-maps',
    'react-native-google-maps',
    'Google-Maps-iOS-Utils',
    'GoogleMaps',
    'RNPermissions',
    'Permission-LocationWhenInUse',
    'Permission-Notifications',
    'react-native-paste-input',
    'vision-camera-code-scanner',
    'VisionCamera'
  ]

  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

  pod 'RNSentry', :path => '../node_modules/@sentry/react-native'

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"

  # This library was the reason we start using use_frameworks! at the beginning
  pod 'RealmSwift', '~>10'
end

target 'OneSignalExtension' do
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
  pod 'SwiftyJSON'
end

# ****** THIS IS THE MAGIC ******
pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
        installer.pod_targets.each do |pod|
            if $static_framework.include?(pod.name)
                def pod.build_type;
                Pod::BuildType.static_library # >= 1.9
            end
        end
    end
end

post_install do |installer|
  #  if !ENV['IS_CI']
  #    flipper_post_install(installer)
  #  end

 # This is also important AND MUST BE IN SAME ORDER
  react_native_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'RCT-Folly'
      target.build_configurations.each do |config|
        config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
      end
    end
  end
  #   __apply_Xcode_12_5_M1_post_install_workaround(installer)
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Pro tip: after applying this and find all the libraries they needs static library change. Remove Pods one last time and remove DerivedData too

Worked perfectly, thanks

akinlekan28 avatar Aug 03 '22 15:08 akinlekan28

Dear @JustineUIT, I hope it's not too late. I'm putting here a fully working Podfile example. Hope also helps who ended up with this discussion further. A briefly key thing to know is the setting pre-installer section in Podfile and marking whole build failing libraries as Static, let's see in example:

# Override Firebase SDK Version
$FirebaseSDKVersion = '8.9.0'

platform :ios, '12.1'

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

# **linkage static is important**
use_frameworks! :linkage => :static
target 'myApp' do
  $static_framework = []
  rn_maps_path = '../node_modules/react-native-maps'

  config = use_native_modules!
  use_react_native!(path: config['reactNativePath'], :hermes_enabled => true)


  # **AUTHOR NOTE:** I didn't try to fix with flipper, we don't want to use anyway. 
       Anybody they would like to try more than welcome
  #  if !ENV['IS_CI']
  #    use_flipper!({
  #      'Flipper' => flipperkit_version,
  #      'Flipper-Folly' => '2.6.10',
  #      'Flipper-DoubleConversion' => '3.2.0',
  #      'Flipper-Glog' => '0.5.0.3',
  #      'Flipper-PeerTalk' => '0.0.4',
  #      'OpenSSL-Universal' => '1.1.1100'
  #    })
  #  end

  # This is the whole magic starts
  # Hit build times and times and which library ever failing add here
  $static_framework += [
    'react-native-maps',
    'react-native-google-maps',
    'Google-Maps-iOS-Utils',
    'GoogleMaps',
    'RNPermissions',
    'Permission-LocationWhenInUse',
    'Permission-Notifications',
    'react-native-paste-input',
    'vision-camera-code-scanner',
    'VisionCamera'
  ]

  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

  pod 'RNSentry', :path => '../node_modules/@sentry/react-native'

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"

  # This library was the reason we start using use_frameworks! at the beginning
  pod 'RealmSwift', '~>10'
end

target 'OneSignalExtension' do
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
  pod 'SwiftyJSON'
end

# ****** THIS IS THE MAGIC ******
pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
        installer.pod_targets.each do |pod|
            if $static_framework.include?(pod.name)
                def pod.build_type;
                Pod::BuildType.static_library # >= 1.9
            end
        end
    end
end

post_install do |installer|
  #  if !ENV['IS_CI']
  #    flipper_post_install(installer)
  #  end

 # This is also important AND MUST BE IN SAME ORDER
  react_native_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'RCT-Folly'
      target.build_configurations.each do |config|
        config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
      end
    end
  end
  #   __apply_Xcode_12_5_M1_post_install_workaround(installer)
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Pro tip: after applying this and find all the libraries they needs static library change. Remove Pods one last time and remove DerivedData too

Worked perfectly, thanks 💯

kevin-mcs avatar Aug 29 '22 07:08 kevin-mcs

Dear @JustineUIT, I hope it's not too late. I'm putting here a fully working Podfile example. Hope also helps who ended up with this discussion further. A briefly key thing to know is the setting pre-installer section in Podfile and marking whole build failing libraries as Static, let's see in example:

# Override Firebase SDK Version
$FirebaseSDKVersion = '8.9.0'

platform :ios, '12.1'

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

# **linkage static is important**
use_frameworks! :linkage => :static
target 'myApp' do
  $static_framework = []
  rn_maps_path = '../node_modules/react-native-maps'

  config = use_native_modules!
  use_react_native!(path: config['reactNativePath'], :hermes_enabled => true)


  # **AUTHOR NOTE:** I didn't try to fix with flipper, we don't want to use anyway. 
       Anybody they would like to try more than welcome
  #  if !ENV['IS_CI']
  #    use_flipper!({
  #      'Flipper' => flipperkit_version,
  #      'Flipper-Folly' => '2.6.10',
  #      'Flipper-DoubleConversion' => '3.2.0',
  #      'Flipper-Glog' => '0.5.0.3',
  #      'Flipper-PeerTalk' => '0.0.4',
  #      'OpenSSL-Universal' => '1.1.1100'
  #    })
  #  end

  # This is the whole magic starts
  # Hit build times and times and which library ever failing add here
  $static_framework += [
    'react-native-maps',
    'react-native-google-maps',
    'Google-Maps-iOS-Utils',
    'GoogleMaps',
    'RNPermissions',
    'Permission-LocationWhenInUse',
    'Permission-Notifications',
    'react-native-paste-input',
    'vision-camera-code-scanner',
    'VisionCamera'
  ]

  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

  pod 'RNSentry', :path => '../node_modules/@sentry/react-native'

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"

  # This library was the reason we start using use_frameworks! at the beginning
  pod 'RealmSwift', '~>10'
end

target 'OneSignalExtension' do
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
  pod 'SwiftyJSON'
end

# ****** THIS IS THE MAGIC ******
pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
        installer.pod_targets.each do |pod|
            if $static_framework.include?(pod.name)
                def pod.build_type;
                Pod::BuildType.static_library # >= 1.9
            end
        end
    end
end

post_install do |installer|
  #  if !ENV['IS_CI']
  #    flipper_post_install(installer)
  #  end

 # This is also important AND MUST BE IN SAME ORDER
  react_native_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'RCT-Folly'
      target.build_configurations.each do |config|
        config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
      end
    end
  end
  #   __apply_Xcode_12_5_M1_post_install_workaround(installer)
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Pro tip: after applying this and find all the libraries they needs static library change. Remove Pods one last time and remove DerivedData too

Thanks, worked here also perfectly :) !

joshke avatar Sep 01 '22 20:09 joshke

Dear @JustineUIT, I hope it's not too late. I'm putting here a fully working Podfile example. Hope also helps who ended up with this discussion further. A briefly key thing to know is the setting pre-installer section in Podfile and marking whole build failing libraries as Static, let's see in example:

# Override Firebase SDK Version
$FirebaseSDKVersion = '8.9.0'

platform :ios, '12.1'

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

# **linkage static is important**
use_frameworks! :linkage => :static
target 'myApp' do
  $static_framework = []
  rn_maps_path = '../node_modules/react-native-maps'

  config = use_native_modules!
  use_react_native!(path: config['reactNativePath'], :hermes_enabled => true)


  # **AUTHOR NOTE:** I didn't try to fix with flipper, we don't want to use anyway. 
       Anybody they would like to try more than welcome
  #  if !ENV['IS_CI']
  #    use_flipper!({
  #      'Flipper' => flipperkit_version,
  #      'Flipper-Folly' => '2.6.10',
  #      'Flipper-DoubleConversion' => '3.2.0',
  #      'Flipper-Glog' => '0.5.0.3',
  #      'Flipper-PeerTalk' => '0.0.4',
  #      'OpenSSL-Universal' => '1.1.1100'
  #    })
  #  end

  # This is the whole magic starts
  # Hit build times and times and which library ever failing add here
  $static_framework += [
    'react-native-maps',
    'react-native-google-maps',
    'Google-Maps-iOS-Utils',
    'GoogleMaps',
    'RNPermissions',
    'Permission-LocationWhenInUse',
    'Permission-Notifications',
    'react-native-paste-input',
    'vision-camera-code-scanner',
    'VisionCamera'
  ]

  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

  pod 'RNSentry', :path => '../node_modules/@sentry/react-native'

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"

  # This library was the reason we start using use_frameworks! at the beginning
  pod 'RealmSwift', '~>10'
end

target 'OneSignalExtension' do
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
  pod 'SwiftyJSON'
end

# ****** THIS IS THE MAGIC ******
pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
        installer.pod_targets.each do |pod|
            if $static_framework.include?(pod.name)
                def pod.build_type;
                Pod::BuildType.static_library # >= 1.9
            end
        end
    end
end

post_install do |installer|
  #  if !ENV['IS_CI']
  #    flipper_post_install(installer)
  #  end

 # This is also important AND MUST BE IN SAME ORDER
  react_native_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'RCT-Folly'
      target.build_configurations.each do |config|
        config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
      end
    end
  end
  #   __apply_Xcode_12_5_M1_post_install_workaround(installer)
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Pro tip: after applying this and find all the libraries they needs static library change. Remove Pods one last time and remove DerivedData too

This really worked, thanks a lot! however I almost have no idea what these pre and post installers do.. and can they be included at the lib level?

brascene avatar Sep 09 '22 08:09 brascene

Dear @JustineUIT, I hope it's not too late. I'm putting here a fully working Podfile example. Hope also helps who ended up with this discussion further. A briefly key thing to know is the setting pre-installer section in Podfile and marking whole build failing libraries as Static, let's see in example:

# Override Firebase SDK Version
$FirebaseSDKVersion = '8.9.0'

platform :ios, '12.1'

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

# **linkage static is important**
use_frameworks! :linkage => :static
target 'myApp' do
  $static_framework = []
  rn_maps_path = '../node_modules/react-native-maps'

  config = use_native_modules!
  use_react_native!(path: config['reactNativePath'], :hermes_enabled => true)


  # **AUTHOR NOTE:** I didn't try to fix with flipper, we don't want to use anyway. 
       Anybody they would like to try more than welcome
  #  if !ENV['IS_CI']
  #    use_flipper!({
  #      'Flipper' => flipperkit_version,
  #      'Flipper-Folly' => '2.6.10',
  #      'Flipper-DoubleConversion' => '3.2.0',
  #      'Flipper-Glog' => '0.5.0.3',
  #      'Flipper-PeerTalk' => '0.0.4',
  #      'OpenSSL-Universal' => '1.1.1100'
  #    })
  #  end

  # This is the whole magic starts
  # Hit build times and times and which library ever failing add here
  $static_framework += [
    'react-native-maps',
    'react-native-google-maps',
    'Google-Maps-iOS-Utils',
    'GoogleMaps',
    'RNPermissions',
    'Permission-LocationWhenInUse',
    'Permission-Notifications',
    'react-native-paste-input',
    'vision-camera-code-scanner',
    'VisionCamera'
  ]

  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

  pod 'RNSentry', :path => '../node_modules/@sentry/react-native'

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"

  # This library was the reason we start using use_frameworks! at the beginning
  pod 'RealmSwift', '~>10'
end

target 'OneSignalExtension' do
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
  pod 'SwiftyJSON'
end

# ****** THIS IS THE MAGIC ******
pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
        installer.pod_targets.each do |pod|
            if $static_framework.include?(pod.name)
                def pod.build_type;
                Pod::BuildType.static_library # >= 1.9
            end
        end
    end
end

post_install do |installer|
  #  if !ENV['IS_CI']
  #    flipper_post_install(installer)
  #  end

 # This is also important AND MUST BE IN SAME ORDER
  react_native_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'RCT-Folly'
      target.build_configurations.each do |config|
        config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
      end
    end
  end
  #   __apply_Xcode_12_5_M1_post_install_workaround(installer)
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Pro tip: after applying this and find all the libraries they needs static library change. Remove Pods one last time and remove DerivedData too

Thank you for such a perfect solution.

talhauzair-28 avatar Oct 03 '22 08:10 talhauzair-28

Does someone know how to fix this error using the expo managed workflow with a standalone (development) client build?

I added the useFrameworks: 'static' option but the build fails with the same error as described above.

Here is the app.json:

{
  "expo": {
    "name": "MyProject",
    "slug": "my-app",
    "owner": "silthus",
    "version": "1.0.0-dev.52",
    "runtimeVersion": "1.8.1",
    "orientation": "portrait",
    "icon": "./assets/images/app-icon-all.png",
    "splash": {
      "image": "./assets/images/splash-logo-all.png",
      "resizeMode": "contain",
      "backgroundColor": "#191015"
    },
    "plugins": [
      "@react-native-firebase/app",
      "@react-native-firebase/perf",
      "@react-native-firebase/crashlytics",
      "expo-notifications",
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static"
          }
        }
      ]
    ],
    "updates": {
      "fallbackToCacheTimeout": 0,
      "url": "https://u.expo.dev/XXXXXXXXXXXXXXXXXXXXXX"
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "android": {
      "icon": "./assets/images/app-icon-android-legacy.png",
      "googleServicesFile": "google-services.json",
      "adaptiveIcon": {
        "foregroundImage": "./assets/images/app-icon-android-adaptive-foreground.png",
        "backgroundImage": "./assets/images/app-icon-android-adaptive-background.png"
      },
      "splash": {
        "image": "./assets/images/splash-logo-android-universal.png",
        "resizeMode": "contain",
        "backgroundColor": "#191015"
      },
      "config": {
        "googleMaps": {
          "apiKey": "XXXXXXXXXXXXXXXXXXXXXXXXX"
        }
      },
      "versionCode": 52
    },
    "ios": {
      "icon": "./assets/images/app-icon-ios.png",
      "supportsTablet": true,
      "splash": {
        "image": "./assets/images/splash-logo-ios-mobile.png",
        "tabletImage": "./assets/images/splash-logo-ios-tablet.png",
        "resizeMode": "contain",
        "backgroundColor": "#191015"
      },
      "config": {
        "googleMapsApiKey": "XXXXXXXXXXXXXXXXX"
      },
      "buildNumber": "1.0.0"
    },
    "web": {
      "favicon": "./assets/images/app-icon-web-favicon.png",
      "splash": {
        "image": "./assets/images/splash-logo-web.png",
        "resizeMode": "contain",
        "backgroundColor": "#191015"
      },
      "build": {
        "babel": {
          "include": [
            "@ui-kitten/components"
          ]
        }
      }
    }
  }
}

Silthus avatar Oct 21 '22 17:10 Silthus

@Silthus I started getting the same error for my Expo project, I'm unsure but I think it started after Expo 46 upgrade. Have you found a solution?

beydogan avatar Oct 24 '22 11:10 beydogan

Same issue here after adding useFrameworks: 'static'

BrodaNoel avatar Oct 25 '22 20:10 BrodaNoel

I made it work following this discussion thread. The solution, or better say workaround, for the problem is the following:

Create a react-native-maps-plugin.js in the root of the project with the following content:

const fs = require('fs');
const path = require('path');
const generateCode = require('@expo/config-plugins/build/utils/generateCode');
const configPlugins = require('@expo/config-plugins');

const code = `
$static_library = [
 'React',
 'Google-Maps-iOS-Utils',
 'GoogleMaps',
 'react-native-maps',
 'react-native-google-maps',
 'React-hermes'
]

pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
    installer.pod_targets.each do |pod|
      bt = pod.send(:build_type)
      if $static_library.include?(pod.name)
        puts "Overriding the build_type to static_library from static_framework for #{pod.name}"
        def pod.build_type;
          Pod::BuildType.static_library
        end
      end
    end
    installer.pod_targets.each do |pod|
      bt = pod.send(:build_type)
      puts "#{pod.name} (#{bt})"
      puts "  linkage: #{bt.send(:linkage)} packaging: #{bt.send(:packaging)}"
    end
end`;

module.exports = (config) => {
    return configPlugins.withDangerousMod(config, [
        'ios',
        async (config) => {
            const filePath = path.join(
                config.modRequest.platformProjectRoot,
                'Podfile'
            );
            const contents = fs.readFileSync(filePath, 'utf-8');

            const addCode = generateCode.mergeContents({
                tag: 'withReactNativeFirebase',
                src: contents,
                newSrc: code,
                anchor: /\s*get_default_flags\(\)/i,
                offset: 2,
                comment: '#',
            });

            if (!addCode.didMerge) {
                console.error(
                    "ERROR: Cannot add withReactNativeMaps to the project's ios/Podfile because it's malformed."
                );
                return config;
            }

            fs.writeFileSync(filePath, addCode.contents);

            return config;
        },
    ]);
};

Then load then plugin inside app.json and set useFrameworks: 'static' and deploymentTarget: "13.0":

...
    "plugins": [
      "@react-native-firebase/app",
      "@react-native-firebase/perf",
      "@react-native-firebase/crashlytics",
      "expo-notifications",
      "./react-native-maps-plugin", // <--- this one here without the .js ending
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static",
            "deploymentTarget": "13.0"
          }
        }
      ]
    ],
...

See the linked thread for more information and some alternative solutions.

In the long run however, I think this should be made as an official Expo plugin. I might send a PR if I find the time.

Silthus avatar Oct 26 '22 04:10 Silthus

Please see the solution: https://github.com/react-native-maps/react-native-maps/issues/3597#issuecomment-1168582636

This solved my problem. @BrodaNoel @beydogan

talhauzair-28 avatar Oct 26 '22 19:10 talhauzair-28