Reputation: 183
i have this Error . RCTConvert+AirMap.h file not found Error on React Native on IOS
Upvotes: 14
Views: 8521
Reputation: 10580
That was an issue I faced on react-native-maps
version 1.4.0
, and as per https://github.com/react-native-maps/react-native-maps/issues/4563#issuecomment-1513857960, upgrading to the newest version fixed the problem.
Upvotes: 1
Reputation: 1945
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|
...
# 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",
Upvotes: 2
Reputation: 6384
this is due to the static framework using. you need some changing in your podfile. here is the pod file for react-native 0.70.6
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '13.0'
install! 'cocoapods', :deterministic_uuids => false
production = ENV["PRODUCTION"] == "1"
pod 'Google-Mobile-Ads-SDK' ,"9.12.0"
pod 'GoogleMobileAdsMediationFacebook','6.11.0.0'
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils'
target 'myApp' do
config = use_native_modules!
$static_framework = []
$RNFirebaseAsStaticFramework = true
$RNGoogleMobileAdsAsStaticFramework = true
$RNAdMobAsStaticFramework = true
$FirebaseSDKVersion = '10.2.0'
use_frameworks! :linkage => :static
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
def pod.build_type;
# Uncomment the line corresponding to your CocoaPods version
Pod::BuildType.static_library # >= 1.9
# Pod::Target::BuildType.static_library # < 1.9
end
end
end
end
# 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.enabled,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
$static_framework += [
'react-native-maps',
'react-native-google-maps',
'Google-Maps-iOS-Utils',
'GoogleMaps',
'RNFirebaseAsStaticFramework',
'RNGoogleMobileAdsAsStaticFramework',
'RNAdMobAsStaticFramework'
]
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly"
pod 'react-native-google-maps', :path => '../node_modules/react-native-maps'
target 'myAppTest' do
inherit! :complete
# Pods for testing
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
# ****** THIS IS THE MAGIC ENDED ******
post_install do |installer|
react_native_post_install(installer)
#############
installer.pods_project.targets.each do |target|
### Added for Maps
if target.name == 'RCT-Folly'
target.build_configurations.each do |config|
config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
end
end
#### Added For Maps Ended
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
# config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "i386 arm64"
end
end
end
############
# __apply_Xcode_12_5_M1_post_install_workaround(installer) # comment for maps
## there two linesare added for maps
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
Upvotes: 0
Reputation: 10252
I was able to fix this with:
Adding $(SRCROOT)/../node_modules/react-native-maps/lib/ios/AirMaps
in the project target header
Moving the pod 'react-native-google-maps', path: rn_maps_path
above use_native_modules (it was previously below that) in the Podfile
Added:
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
pod deintegrate
, pod install
, remove derived data
, clean build
)Upvotes: 5
Reputation: 12582
Latest Update
"react": "17.0.1",
"react-native": "0.64.2",
"react-native-cli": "^2.0.1",
"react-native-maps": "^0.28.0",
Its pretty much easier to configure React Native Maps using GoogleMap and other map providers.
Auto-linking does not solve the problem so you will have to manually tell xcode
where the native code is.
There are 2 ways to tell
Xcode
for tweaking header search path
# Podfile
pod 'react-native-google-maps', :path => '../../../node_modules/react-native-maps/'
pod 'react-native-maps', :path => '../../../node_modules/react-native-maps/'
# These might not be necessary
# Please build without these. If could not build, add these as well
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils'
in AppDelegate.m
file
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h> // this line is alreaady there. Add the line below
#import <GoogleMaps/GoogleMaps.h>
...
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions // this line is alreaady there. Add the line below
{
+ [GMSServices provideAPIKey:@"AIzaEEBBLn-PhCDDD1AnC_h66yH8LEEUkd14WW0"]; // add this line using the api key obtained from Google Console
Notes:
AIzaEEBBLn-PhCDDD1AnC_h66yH8LEEUkd14WW0
with your own API Key from google console.'../../../node_modules/react-native-maps/'
. In your case its '../node_modules/react-native-maps/'
+
and -
sign should be used. They are language defined entities. No type errorUpvotes: 3