【发布时间】:2020-08-05 08:18:46
【问题描述】:
【问题讨论】:
-
面临同样的错误。 @cute soft 你有解决方法吗?
标签: ios xcode react-native
【问题讨论】:
标签: ios xcode react-native
最新更新
"react": "17.0.1",
"react-native": "0.64.2",
"react-native-cli": "^2.0.1",
"react-native-maps": "^0.28.0",
使用 GoogleMap 和其他地图提供者配置 React Native Maps 要容易得多。
自动链接并不能解决问题,因此您必须手动告诉xcode 本地代码在哪里。
有两种方式告诉
Xcode 进行调整 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'
在AppDelegate.m 文件中
#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
注意事项:
AIzaEEBBLn-PhCDDD1AnC_h66yH8LEEUkd14WW0 替换为您在 Google 控制台中的 API 密钥。'../../../node_modules/react-native-maps/'。在您的情况下,它是'../node_modules/react-native-maps/'
+ 和- 符号。它们是语言定义的实体。没有类型错误【讨论】:
我能够解决这个问题:
在项目目标头中添加$(SRCROOT)/../node_modules/react-native-maps/lib/ios/AirMaps
将 pod 'react-native-google-maps', path: rn_maps_path 移动到 Podfile 中的 use_native_modules 上方(之前在该模块下方)
添加:
post_install do |installer|
//...
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)【讨论】: