我正在使用 react-native-maps 并尝试使用 iOS 版 Google 地图,我按照 https://github.com/airbnb/react-native-maps/issues/693 的上述说明进行操作,因此我从 pod 安装中收到错误:
找不到名为AirMapsExplorer
的目标
这是我拥有的 podfile
# You Podfile should look similar to this file. React Native currently does not support use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
# Change 'AirMapsExplorer' to match the target in your Xcode project.
target 'AirMapsExplorer' do
pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
pod 'React', path: '../../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
'BatchedBridge'
]
pod 'GoogleMaps' # <~~ remove this line if you do not want to support GoogleMaps on iOS
pod 'react-native-maps', path: '../../'
pod 'react-native-google-maps', path: '../../' # <~~ 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
end
end
我重新启动了设备(现在已经 2 次(删除了 pod 文件夹和 podfile,再次按照说明进行操作并收到相同的错误。我什至尝试进行干净的构建和干净的文件夹仍然无济于事。
如果您遇到此错误,任何人都会遇到此错误或遇到修复方法。我不经常使用 xcode,因为我使用 React Native 进行构建,并且尽量不要使用 xcode,除非我绝对必须为 iOS。
如果您希望我展示其他内容,我将帮助调试此问题。谢谢
当你开始这个项目时,你需要在你的目标中输入XCode创建的xcodeproj
的名称,你还需要检查你的.podFile
是否在你的xcodeproj
文件目录中,我也认为你错过了这一行
workspace 'AirMapsExplorer'
这将创建一个集成了 Pod 的工作空间
您的 Pod 文件已修改
# You Podfile should look similar to this file. React Native currently does not support use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
workspace 'AirMapsExplorer'
# Change 'AirMapsExplorer' to match the target in your Xcode project.
target 'AirMapsExplorer' do
pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
pod 'React', path: '../../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
'BatchedBridge'
]
pod 'GoogleMaps' # <~~ remove this line if you do not want to support GoogleMaps on iOS
pod 'react-native-maps', path: '../../'
pod 'react-native-google-maps', path: '../../' # <~~ 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
end
end
希望这有帮助