繁体   English   中英

在获得的项目上安装 Cocoapods 时遇到问题

[英]Having trouble installing Cocoapods on an obtained project

我从一位同事那里收到了一个项目,该项目没有包含在文件中的框架,我认为这不会是一个大问题,因为我过去使用过 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

尝试这样做

pod deintegrate
pod install
pod update

一个好的起点可以是运行pod deintegrate命令。

过去,当我遇到 CocoaPods 问题时,从头开始重新启动配置可以解决我的错误。

您可以尝试以下命令从头开始。 确保将您的 Pod 文件搁置在其他地方,以便您可以参考要安装的框架。

$ sudo gem install cocoapods-deintegrate cocoapods-clean
$ pod deintegrate
$ pod cache clean --all
$ rm Podfile

然后,跟进并执行:

pod install
pod update

或者,由于您使用的是 React,您的节点安装可能有问题,在这种情况下,我建议您参考这篇文章

注意:可能发生的情况是您的框架已经过时了,它们可能会缓存在您的系统中,从而链接到较旧的不匹配引用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM