使用CocoaPods有什么优势? [英] What is the advantage of using CocoaPods?

查看:79
本文介绍了使用CocoaPods有什么优势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只需将一些文件拖到项目中,就可以手动安装许多Pod。对我来说,这似乎是一种安装Pod的更便捷的方法。

A lot of the pods can be installed "manually" by simply dragging some files to the project. To me, this seems like a more convenient way to install a pod.

如果我使用CocoaPods,则必须创建一个PodFile并执行一堆命令,然后添加将该框架添加到链接的框架和库部分,然后进行重建。这似乎是很多工作。然而,CocoaPods是安装吊舱的推荐方式。

If I used CocoaPods, I would have to create a PodFile and execute a bunch of commands, add the framework to the "Linked Frameworks and Libraries" section, and rebuild. That seems like a lot of work. Yet CocoaPods is the "recommended" way to install pods.

我知道CocoaPods可以为您检测更新。但这并不像您打开Xcode并弹出一条消息,说您的一个pod已过时。您已经手动使用命令来检查更新。我的意思是,您要安装广告连播的原因是,您要使用广告连播提供的功能之一,而又不想自己编写。因此,使用新功能进行更新可能不会使我受益匪浅。

I know that CocoaPods can detect updates for you. But it's not like you open Xcode and a message pops up that says one of your pods is outdated. You have manually use a command to check for updates. I mean, the reason you want to install a pod is because you want to use one of the features provided by the pod and you don't want to write it yourself. So an update with new features is probably not going to benefit me a lot.

还有像AdMob SDK这样的大型库,甚至提醒您,当有更新时您可以运行该应用程序。

And large-scale libraries like the AdMob SDK, even reminds you that an update is available when you run the app.

CocoaPods除了检测到您的更新之外,还有其他优势吗?

Are there other advantages of CocoaPods other than that it detects updates for you?

聚苯乙烯由于新版本的CocoaPods中的错误,我几次破坏了我的项目。拖动文件永远不会发生这种情况。

P.S. I corrupted my project a few times because of bugs in the new version of CocoaPods. This never happens with dragged-in files...

推荐答案

使用Cocoapod而不是手动管理项目中的依赖项有很多优点。我列出了其中的一些

There are many pros of using Cocoapod over manually managing Dependencies in your project. I list few of them


  • lib可能会引用Cocoapod会自己照顾的另一个依赖项。您必须手动下载其中的每一个。

  • 库具有某些要求,例如OS版本,框架导入等。在 Objective C 中,手动添加框架是一件痛苦的事。没有它。因此,可可足是野兽。

  • 对于其他编码器来说,手动添加的依赖项可能并不容易。 Pod可确保您可以通过Pod方案或 Podfile 来了解您使用的内容。

  • 当您必须删除上一个文件并添加新文件(点击次数过多)时,用新版本替换lib会很麻烦。 pod install 会使用一个命令自动完成。

  • A lib may refer another dependency which Cocoapod will take care itself. Manually you would have to download each one of them.
  • Lib has certain requirements like OS version, framework imports etc. Manual framework adding were a pain in Objective C.. swift doesn't have it. Cocoapod were a beast therefore back then.
  • Manually added dependency might not be easy to find for another coder. Pods ensure that one can go through the pods scheme or Podfile to understand what you have used.
  • Replacing a lib with new version is a pain manually when you have to delete prev files and add new - too many clicks. pod install will do it automatically using one command.

最初在项目中安装Pod时,添加库的所有其他步骤比手动添加Lib所需的技术知识更容易。

Also keeping aside the initial setup of pod in a project, all other steps of adding libraries is easier than the technical knowledge required to add a Lib manually.

这篇关于使用CocoaPods有什么优势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆