[英]Cannot install React subspec in CocoaPods
这是我目前的Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'atom' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'Firebase/Core', '~> 5.20.1'
pod 'Firebase/Firestore', '~> 5.20.1'
pod 'Firebase/Auth', '~> 5.20.1'
pod 'Firebase/Storage', '~> 5.20.1'
pod 'Firebase/Database', '~> 5.20.1'
pod 'Firebase/Messaging', '~> 5.20.1'
pod 'Firebase/Functions', '~> 5.20.1'
pod 'Firebase/DynamicLinks', '~> 5.20.1'
pod 'Firebase/Performance', '~> 5.20.1'
pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
pod 'react-native-maps', :path => '../node_modules/react-native-maps'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
当我尝试添加这个:
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'RCTGeolocation',
]
我收到此错误:
$ pod install
Ignoring unf_ext-0.0.7.4 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.4
Analyzing dependencies
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `react-native-image-picker` from `../node_modules/react-native-image-picker`
Fetching podspec for `react-native-maps` from `../node_modules/react-native-maps`
[!] CocoaPods could not find compatible versions for pod "React/RCTGeolocation":
In Podfile:
React/RCTGeolocation (from `../node_modules/react-native`)
None of your spec sources contain a spec satisfying the dependency: `React/RCTGeolocation (from `../node_modules/react-native`)`.
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
我尝试过pod repo update
,但错误仍然存在。
我在React-native 0.59上。 部署目标9.0。
版本0.60我遇到了同样的问题。 我发现地理位置已经从反应原生核心中移除了。
通过将其用作单独的模块来修复它。
react-native-geolocation中的安装说明和文档。
毕竟需要PS导入!
首先,<= 0.59和> = 0.60使用完全不同的pod文件作为核心移动到pod以获取依赖关系。
这是0.59及以下:
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'ART',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTNetwork',
'RCTText',
'RCTWebSocket', # Needed for debugging
'RCTAnimation', # Needed for FlatList and animations running on native UI thread
'RCTGeolocation',
'RCTImage',
'RCTBlob',
'RCTActionSheet',
'RCTSettings',
'RCTVibration',
'RCTPushNotification',
'RCTLinkingIOS'
# Add any other subspecs you want to use in your project
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
不要忘记包括瑜伽,否则你会收到错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.