【问题标题】:React Native Fetch Blob issue pod not installing for IOSReact Native Fetch Blob 问题 pod 未为 IOS 安装
【发布时间】:2019-10-09 13:23:02
【问题描述】:

使用 React Native Fetch Blob 执行一些操作。但是 IOS 平台没有安装在 pod 文件中。显示这个...

[!] CocoaPods could not find compatible versions for pod "React/Core":
  In Podfile:
    react-native-fetch-blob (from `../node_modules/react-native-fetch-blob`) was resolved to 0.10.6, which depends on
      React/Core

None of your spec sources contain a spec satisfying the dependency: `React/Core`.

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 文件 这是我的 pod 文件,我无法在其中添加 React 本机 fetch blob。

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target  do
  # Pods for 
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'

  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'



  target 'WorkreapMobileTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'WorkreapMobile-tvOS' do
  # Pods for WorkreapMobile-tvOS

  target 'WorkreapMobile-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

这是我的 pod 文件,我无法在其中添加 React 本机 fetch blob。

【问题讨论】:

  • 你的Podfile中有pod 'React-Core', :path => '../node_modules/react-native/'吗?
  • @KevinEtore 是的,我的 pod 文件中有这个
  • 您是否按照建议尝试了pod install --repo-update

标签: react-native cocoapods


【解决方案1】:

在根目录中

grep -rl "s.dependency 'React/Core'" node_modules/ | xargs sed -i '' 's=React/Core=React-Core=g'

【讨论】:

  • 如果您使用的是 gnu 版本的 sed,请使用 grep -rl "s.dependency 'React/Core'" node_modules/ | xargs sed -i 's=React/Core=React-Core=g'
  • 谢谢卡斯拉先生
  • 更新:每次添加新包并运行pod install时可能需要执行此命令。就我而言,安装新软件包后我再次收到错误并执行此命令并再次修复。
猜你喜欢
  • 2020-05-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多