我从一个同事那里收到了一个项目,该项目没有包含文件中的框架,我不认为这是一个大问题,因为我过去使用Cocoapods时从未遇到任何问题,但是我确实在安装这些程序时遇到了麻烦。以下是我的Podfile和尝试执行pod install
时收到的错误。有人可以告诉我哪里出了问题,并告诉我如何解决它。
错误日志:
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
[!] CocoaPods could not find compatible versions for pod "React/RCTVibration":
In Podfile:
React/RCTVibration (from `../node_modules/react-native`)
None of your spec sources contain a spec satisfying the dependency: `React/RCTVibration (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.
[!] Automatically assigning platform `iOS` with version `9.0` on target `bestride` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`
Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
project 'bestride.xcodeproj'
target 'bestride' do
rn_path = '../node_modules/react-native'
rn_maps_path = '../node_modules/react-native-maps'
# See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
'Core',
'CxxBridge',
'DevSupport',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
]
# React Native third party dependencies podspecs
pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
# If you are using React Native <0.54, you will get the following error:
# "The name of the given podspec `GLog` doesn't match the expected one `glog`"
# Use the following line instead:
#pod 'GLog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec"
pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"
# react-native-maps dependencies
pod 'react-native-maps', path: rn_maps_path
pod 'react-native-google-maps', path: rn_maps_path # Uncomment this line if you want to support GoogleMaps on iOS
pod 'GoogleMaps' # Uncomment this line if you want to support GoogleMaps on iOS
pod 'Google-Maps-iOS-Utils' # Uncomment this line if you want to support GoogleMaps on iOS
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
pod 'FBSDKCoreKit', '~>4.42.0'
pod 'FBSDKLoginKit', '~>4.42.0'
pod 'FBSDKShareKit', '~>4.42.0'
pod 'GoogleSignIn'
pod 'RNGoogleSignin', :path => '../node_modules/react-native-google-signin'
pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
pod 'react-native-camera', :path => '../node_modules/react-native-camera'
pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'
pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'
pod 'RNSVG', :path => '../node_modules/react-native-svg'
pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
pod 'react-native-date-picker', :path => '../node_modules/react-native-date-picker'
pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
pod 'react-native-webview', :path => '../node_modules/react-native-webview'
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
答案 0 :(得分:0)
尝试这样做
pod deintegrate
pod install
pod update
答案 1 :(得分:0)
一个好的起点可以是运行pod deintegrate
命令。
过去,当我遇到CocoaPods问题时,从头开始重新配置可以解决我的错误。
您可以尝试使用以下命令从头开始。确保将Pod文件搁置在其他位置,以便您可以参考要安装的框架。
$ sudo gem install cocoapods-deintegrate cocoapods-clean
$ pod deintegrate
$ pod cache clean --all
$ rm Podfile
然后,跟进并执行:
pod install
pod update
或者,由于您使用的是React,因此您的节点安装可能会有问题,在这种情况下,我建议您参考this post
注意:可能发生的情况是您的框架已经过时,并且可能已缓存在您的系统中,因此链接到较旧的不匹配引用。