为什么命令 `pod install` 或 `pod update pod_name` 安装这么多文件?

Why does the command `pod install` or `pod update pod_name` install so many files?

我在我的 react-native ios 项目中使用 firebase 动态 links。

Cocoapods version --- 1.5.3 xcode version --- 9.4.1

当我尝试使用 pod update Firebase/DynamicLinks 更新 pod Firebase/DynamicLinks 时,它不仅更新了那个 pod,还更新了许多其他 pod,最重要的是它弃用了对 v0.11.0 的反应,当我这样做时git状态,我看到文件added/modified超过1100个。

此外,构建失败并出现类似 argument list too long.

的错误

我不明白为什么这种情况总是发生在可可足类身上。

我在将 segment-io 安装到我的 React Native 项目时遇到了同样的问题,所以我不得不手动 link 该项目。

但 firebase 动态 links 不是 javascript 库,因此不存在手动 linking 的问题。

谁能指出解决方案?

之所以如此,是因为 RN podspec 非常旧且无人维护——Facebook 不使用 cocapods。

要修复它,请将其添加到您的目标中(在 Podfile 中)。

pod 'DoubleConversion', :podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
pod 'Folly', :podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec"
pod 'glog', :podspec => "../node_modules/react-native/third-party-podspecs/GLog.podspec"
pod 'React', path: '../node_modules/react-native', subspecs: [
  'Core',
  'CxxBridge',
  'RCTAnimation',
  'RCTActionSheet',
  'RCTImage',
  'RCTLinkingIOS',
  'RCTNetwork',
  'RCTSettings',
  'RCTText',
  'RCTVibration',
  'RCTWebSocket',
  'RCTPushNotification',
  'RCTCameraRoll',
  'RCTSettings',
  'RCTBlob',
  'RCTGeolocation',
  'DevSupport'
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

这将告诉 cocoapods 使用来自 node_nodules 的 React Native 和其他需要的库 - 版本在您的 package.json

中定义

Podfile 的脚本广告底部(在目标之后):

post_install do |installer_representation|
  installer_representation.pods_project.targets.each do |target|
      if target.name == "React"
          target.remove_from_project
      end
  end
end

未来有改进的计划:https://github.com/react-native-community/discussions-and-proposals/pull/18

When I tried to update the pod Firebase/DynamicLinks, using pod update Firebase/DynamicLinks, it updates not only that pod but so many others ...

基本上,发生这种情况是因为 Firebase/DynamicLinks 依赖于 其他存储库 (pods),这意味着为了更新 Firebase/DynamicLinks,他们的依赖项也应该得到更新。

作为建议,您应该手动提及适合您的项目的最新版本;在你的 podfile:

pod `Firebase/DynamicLinks`, 'here is the specific proper version'

请注意,在不提及 pod 使用的版本的情况下,它应该安装最新的版本,这可能不是适合您的情况。