我正面临这个问题,我相信很多其他人在经过一番搜索后都面临着这个问题。我正在尝试手动安装 Google maps IOS SDK 而不是 pods 方法。任何与 pod 有关的解决方案都不适合我。我能够渲染地图,但是当我提供“provider google”时,它会抛出错误。我需要谷歌地图而不是苹果地图。到目前为止我做了什么:
我的 package.json 片段:
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"moment": "^2.22.2",
"npm": "^6.5.0",
"react": "16.6.3",
"react-native": "0.57.8",
"react-native-blur": "^3.2.2",
"react-native-drawer": "^2.5.0",
"react-native-elements": "^0.19.1",
"react-native-maps": "^0.23.0",
我正在关注这个文档,除了一些小的调整之外,我认为它非常准确。
我的反应本机组件,它呈现地图。
import React from 'react'
import { ScrollView, View } from 'react-native'
import styles from './style'
import MapView, { PROVIDER_GOOGLE } from 'react-native-maps'
class Location extends React.Component {
render () {
return (
<View style={styles.container}>
<MapView
provider={PROVIDER_GOOGLE} // remove if not using Google Maps
style={styles.map}
region={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.015,
longitudeDelta: 0.0121,
}}
>
</MapView>
</View>
)
}
}
我的 Xcode 文件层次结构:
链接的图书馆:
此外,我在构建设置中包含了标题搜索中的路径。此外,我在 Xcode 中的库下包含了 AirMaps.xcodeproj。我已经看到了更多使用 Podfile 的解决方案,但我很好奇是否有人通过解决此错误手动完成了它。我不确定我做错了什么。