ykn*_*121 7 xcode ios react-native react-native-maps
console.error:“ react-native-maps” AirGoogleMaps目录必须添加到您的xCode项目中
尝试在react-native-maps模块中测试示例时出现此错误。
GitHub:https : //github.com/airbnb/react-native-maps/tree/master/example
显然,我应该将dir添加到我的Xcode项目中,但是我不知道如何添加它们。
我可以举一个将目录添加到Xcode项目的示例吗?
最近我遇到了这个问题,通过对 pod 文件进行一些更改解决了我的问题。
source 'https://github.com/CocoaPods/Specs.git'
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'AppName' do
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'RCTText',
'RCTImage',
'RCTAnimation',
'RCTActionSheet',
'RCTLinkingIOS',
'RCTSettings',
'RCTVibration',
'RCTNetwork',
'RCTWebSocket',
'DevSupport',
'BatchedBridge',
'RCTGeolocation',
]
pod 'GoogleMaps' # Remove this line if you don't want to support GoogleMaps on iOS
pod 'react-native-maps', path: '../node_modules/react-native-maps'
pod 'react-native-google-maps', path: '../node_modules/react-native-maps' # If you need GoogleMaps support on iOS
end
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
if target.name == "React"
target.remove_from_project
end
end
end
Run Code Online (Sandbox Code Playgroud)
另外,在你的 JS 文件中,你的映射标签必须是这样的
<MapView
provider={PROVIDER_GOOGLE}
style={styles.map}
// provider='google'
// mapType='standard'
...
>
Run Code Online (Sandbox Code Playgroud)
请注意,您的 pod 文件必须正确链接。不需要手动添加任何东西。您可以使用此命令删除 pod 文件和路径
pod deintegrate
Run Code Online (Sandbox Code Playgroud)
和
pod clean
Run Code Online (Sandbox Code Playgroud)
并安装 Cocoapods-Deintegrate 插件和 Cocoapods-Clean 插件
在终端上使用以下命令来安装它。
sudo gem install cocoapods-deintegrate
Run Code Online (Sandbox Code Playgroud)
Cocoapods-Clean 插件
在终端上使用以下命令来安装它。
sudo gem install cocoapods-clean
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助你。
| 归档时间: |
|
| 查看次数: |
3693 次 |
| 最近记录: |