增加 IOS 平台版本会引发 react-native-maps 错误,减少它会引发其他 react-native 库的错误
Increasing IOS platform version throws error for react-native-maps, reducing it throws error for other react-native libraries
我正在为我的 react-native 应用程序编写测试,但它失败了,建议我 运行 pod install。 运行ning pod 安装后,我得到
!] CocoaPods could not find compatible versions for pod "GoogleMaps":
In Podfile:
react-native-google-maps (from `../node_modules/react-native-maps`) was resolved to 0.27.1, which depends on
GoogleMaps (= 3.5.0)
react-native-google-places (from `../node_modules/react-native-google-places`) was resolved to 3.1.2, which depends on
GoogleMaps (~> 3.1.0)
Specs satisfying the `GoogleMaps (~> 3.1.0), GoogleMaps (= 3.5.0)` dependency were found, but they required a higher minimum deployment target.
将我的部署目标降低到 9.0 会引发另一个错误:
!] CocoaPods could not find compatible versions for pod "React-jsiexecutor":
In Podfile:
React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
Specs satisfying the `React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)` dependency were found, but they required a higher minimum deployment target.
第一个错误消失了。
这是我的 pod 文件的样子:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'MonkeyMusic' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
pod 'GoogleMaps', '~> 3.1.0'
pod 'Google-Maps-iOS-Utils'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'react-native-google-places', :path => '../node_modules/react-native-google-places'
target 'MonkeyMusicTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# use_flipper!({ 'Flipper-Folly' => '2.3.0' })
post_install do |installer|
flipper_post_install(installer)
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-places'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
# config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET
config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
end
end
if target.name == "React"
target.remove_from_project
end
end
end
end
target 'MonkeyMusic-tvOS' do
# Pods for MonkeyMusic-tvOS
target 'MonkeyMusic-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
如果这个问题能得到解决,我会很高兴。它已经偷走了超过12小时的开发时间。
好吧,我不是 React Native 方面的专家,但我知道 Cocoapods 是如何工作的,看起来版本有冲突,因为 react-native-google-places
需要 GoogleMaps
版本 ~> 3.1.0(这意味着 3.1.x),而 react-native-google-maps
需要它正好是 3.5.0。您可以在模块 podspec 文件中查看:
- node_modules/react-native-google-places/react-native-google-places.podspec
- node_modules/react-native-maps/react-native-google-maps.podspec
我看不到从 pod 文件解决这个问题的方法,因为它要么是模块安装的问题,要么是过时的 podspec 文件配置。
一般来说,此类冲突可以通过升级或降级 pods 依赖项之一来解决。因此,在您的情况下,为了使其正常工作,您可以转到 react-native-google-places.podspec
并将那里的依赖项更新为:
s.dependency 'GooglePlaces', '~> 3.5.0'
s.dependency 'GoogleMaps', '~> 3.5.0'
这不是一个理想的解决方案,因为显然它应该在原始 podspec 源文件中修复,但如果您只是想让它工作,它可能会有所帮助。
此外,使用 thread 中提到的补丁包可能会有更好的解决方案,这实际上是关于您遇到的问题。
我正在为我的 react-native 应用程序编写测试,但它失败了,建议我 运行 pod install。 运行ning pod 安装后,我得到
!] CocoaPods could not find compatible versions for pod "GoogleMaps":
In Podfile:
react-native-google-maps (from `../node_modules/react-native-maps`) was resolved to 0.27.1, which depends on
GoogleMaps (= 3.5.0)
react-native-google-places (from `../node_modules/react-native-google-places`) was resolved to 3.1.2, which depends on
GoogleMaps (~> 3.1.0)
Specs satisfying the `GoogleMaps (~> 3.1.0), GoogleMaps (= 3.5.0)` dependency were found, but they required a higher minimum deployment target.
将我的部署目标降低到 9.0 会引发另一个错误:
!] CocoaPods could not find compatible versions for pod "React-jsiexecutor":
In Podfile:
React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
Specs satisfying the `React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)` dependency were found, but they required a higher minimum deployment target.
第一个错误消失了。
这是我的 pod 文件的样子:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'MonkeyMusic' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
pod 'GoogleMaps', '~> 3.1.0'
pod 'Google-Maps-iOS-Utils'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'react-native-google-places', :path => '../node_modules/react-native-google-places'
target 'MonkeyMusicTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# use_flipper!({ 'Flipper-Folly' => '2.3.0' })
post_install do |installer|
flipper_post_install(installer)
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-places'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
# config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET
config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
end
end
if target.name == "React"
target.remove_from_project
end
end
end
end
target 'MonkeyMusic-tvOS' do
# Pods for MonkeyMusic-tvOS
target 'MonkeyMusic-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
如果这个问题能得到解决,我会很高兴。它已经偷走了超过12小时的开发时间。
好吧,我不是 React Native 方面的专家,但我知道 Cocoapods 是如何工作的,看起来版本有冲突,因为 react-native-google-places
需要 GoogleMaps
版本 ~> 3.1.0(这意味着 3.1.x),而 react-native-google-maps
需要它正好是 3.5.0。您可以在模块 podspec 文件中查看:
- node_modules/react-native-google-places/react-native-google-places.podspec
- node_modules/react-native-maps/react-native-google-maps.podspec
我看不到从 pod 文件解决这个问题的方法,因为它要么是模块安装的问题,要么是过时的 podspec 文件配置。
一般来说,此类冲突可以通过升级或降级 pods 依赖项之一来解决。因此,在您的情况下,为了使其正常工作,您可以转到 react-native-google-places.podspec
并将那里的依赖项更新为:
s.dependency 'GooglePlaces', '~> 3.5.0'
s.dependency 'GoogleMaps', '~> 3.5.0'
这不是一个理想的解决方案,因为显然它应该在原始 podspec 源文件中修复,但如果您只是想让它工作,它可能会有所帮助。
此外,使用 thread 中提到的补丁包可能会有更好的解决方案,这实际上是关于您遇到的问题。