不同 iOS 版本的 cocoapods
Different iOS version cocoapods
由于 iOS 9 已发布,我想为用户提供坚持使用 iOS 8 或仅使用最新版本的 SDK 的可能性。
在 git 上创建双分支很容易,但我如何在 CocoaPods 中处理这个选择?我如何让用户选择要下载的 SDK 版本,即使我不断更新和扩展 iOS 8 和 iOS 9 之一?
可能让用户选择的唯一方法是完成 iOS 8 版本,然后才开始发布 iOS 9 一个,放弃另一个。
希望我没说错。
提前致谢。
您可以在 pod 文件中指定要在您的项目中使用的 cocoa pod 版本。
Besides no version, or a specific one, it is also possible to use
logical operators:
'> 0.1' Any version higher than 0.1 '>= 0.1' Version 0.1 and any
higher version '< 0.1' Any version lower than 0.1 '<= 0.1' Version 0.1
and any lower version In addition to the logic operators CocoaPods has
an optimistic operator ~>:
'~> 0.1.2' Version 0.1.2 and the versions up to 0.2, not including 0.2
and higher '~> 0.1' Version 0.1 and the versions up to 1.0, not
including 1.0 and higher '~> 0' Version 0 and higher, this is
basically the same as not having it.
所以假设您的 iOS 8 支持的 SDK 是 v1.0.0,而您的 iOS 9 支持的 SDK 是 v2.0.0。
如果您的用户正确设置了 pod 文件(对于 iOS 8,仅使用 ~> 2.0.0
和 iOS 9 只使用 >= 2.0.0
),他们应该没有什么可担心的。
由于 iOS 9 已发布,我想为用户提供坚持使用 iOS 8 或仅使用最新版本的 SDK 的可能性。
在 git 上创建双分支很容易,但我如何在 CocoaPods 中处理这个选择?我如何让用户选择要下载的 SDK 版本,即使我不断更新和扩展 iOS 8 和 iOS 9 之一?
可能让用户选择的唯一方法是完成 iOS 8 版本,然后才开始发布 iOS 9 一个,放弃另一个。 希望我没说错。
提前致谢。
您可以在 pod 文件中指定要在您的项目中使用的 cocoa pod 版本。
Besides no version, or a specific one, it is also possible to use logical operators:
'> 0.1' Any version higher than 0.1 '>= 0.1' Version 0.1 and any higher version '< 0.1' Any version lower than 0.1 '<= 0.1' Version 0.1 and any lower version In addition to the logic operators CocoaPods has an optimistic operator ~>:
'~> 0.1.2' Version 0.1.2 and the versions up to 0.2, not including 0.2 and higher '~> 0.1' Version 0.1 and the versions up to 1.0, not including 1.0 and higher '~> 0' Version 0 and higher, this is basically the same as not having it.
所以假设您的 iOS 8 支持的 SDK 是 v1.0.0,而您的 iOS 9 支持的 SDK 是 v2.0.0。
如果您的用户正确设置了 pod 文件(对于 iOS 8,仅使用 ~> 2.0.0
和 iOS 9 只使用 >= 2.0.0
),他们应该没有什么可担心的。