react-native-maps: 'RCTConvert+AirMap.h' file not found

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

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 32 (3 by maintainers)

Commits related to this issue

Most upvoted comments

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

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.

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

To be more specific about the additional statements you need to add to your files:

Additional statements need to be added to Podfile:

# Podfile:
...
# Platform should be at least 13.0
platform :ios, '13.0'
# ...

# add the following 2 statements
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils'

target 'casualjob' do
	# add the following 2 statements (if not present)
	rn_maps_path = '../node_modules/react-native-maps'
	pod 'react-native-google-maps', :path => rn_maps_path
	# ....

     post_install do |installer|
        react_native_post_install(
           installer,
           # Set `mac_catalyst_enabled` to `true` in order to apply patches
           # necessary for Mac Catalyst builds
          :mac_catalyst_enabled => false
      )
	# ...
        # add the following section
        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

Additional statements need to be added to AppDelegate.mm:

// AppDelegate.mm
// ...
#import "AppDelegate.h"
// ...
// Add the following statement (if not present)
#import <GoogleMaps/GoogleMaps.h>
// ...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  // add the following statement (if not present)
  // Replace YOUR_API_KEY below with your project's Google API Key
  [GMSServices provideAPIKey:@"YOUR_API_KEY"];
// ...
}
// ...

For the configuration:

"react": "18.1.0",
"react-native": "0.70.1",
"react-native-maps": "^1.3.2",

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.

@jakobsen9 Try this #4563 (comment)

Thanks, I found this earlier – works like a charm 🙌

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!

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

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

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 saved the day !! Thanks a lot.

Here is my version of the podfile,

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
# Push Notification Setup
use_frameworks! :linkage => :static # With Hermes enabled
$RNFirebaseAsStaticFramework = true


platform :ios, '13.0' # Min iOS version required by Google Maps
prepare_react_native_project!


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 'MyApp' do
  # Google Maps SDK for iOS
  $static_framework = []

  config = use_native_modules!

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

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => FlipperConfiguration.disabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  # Google Maps SDK for iOS
  $static_framework += [
    'react-native-maps',
    'react-native-google-maps',
    'Google-Maps-iOS-Utils',
    'GoogleMaps',
    # 'RNPermissions',
    # 'Permission-LocationWhenInUse',
  ]

  # Google Maps SDK for iOS
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'
  # The following line is only needed if building on an Apple silicon Mac without rosetta.
  # pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/Simon-TechForm/google-maps-ios-utils.git', :branch => 'feat/support-apple-silicon'


  # Important step for Google Maps SDK for iOS 
  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|
    react_native_post_install(installer)
    # Important step for Google Maps SDK for iOS
    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
    # Important step for Google Maps SDK for iOS
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
    #   __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

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 😃 !

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 💯

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