简体   繁体   English

Xcode Versioning在框架上构建设置

[英]Xcode Versioning Build Settings on frameworks

I am working on an iOS framework based on the following template : https://github.com/jverkoey/iOS-Framework 我正在开发基于以下模板的iOS框架: https//github.com/jverkoey/iOS-Framework

Now I need to polish a little bit, and setup the versioning system with the appropriate build/marketing number. 现在我需要稍微改进一下,并使用适当的构建/营销编号设置版本控制系统。

This framework project has 3 targets, the 1st one that generates a static library, a 2nd one that generates a resources bundle and a 3rd target that is an aggregate target for the static library and the resource bundle. 该框架项目有3个目标,第一个生成静态库,第二个生成资源包,第三个目标是静态库和资源包的聚合目标。 So my first problem is to determine on which target I should configure the versioning build settings (or if I should configure all the targets). 所以我的第一个问题是确定我应该在哪个目标上配置版本控制构建设置(或者我应该配置所有目标)。

My 2nd question is what are the settings that I should configure and what do they mean : 我的第二个问题是我应该配置什么设置以及它们的含义:

Current Project Version => Is it the build version or the marketing version ? 当前项目版本=>是构建版本还是营销版本? So if I release apps with versions like : 1.2.3.4, should I set 4 ? 因此,如果我发布的应用程序版本如:1.2.3.4,我应该设置4吗? or 1.2.3 ? 还是1.2.3? or 1.2.3.4 ? 或1.2.3.4?

Generated Versioning Source Filename => The name of the .c file generated that contains the integer build number I guess ? 生成的版本控制源文件名=>生成的.c文件的名称,包含我猜的整数构建号?

Generated Versioning Variables => What is it ? 生成的版本控制变量=>这是什么?

Versioning Name Prefix => A prefix for the name of the variable that contains the build number 版本控制名称前缀=>包含内部版本号的变量名称的前缀

Versioning Name Suffix => A suffix for the name of the variable that contains the build number 版本控制名称后缀=>包含内部版本号的变量名称的后缀

Versioning System: Everybody use Apple Generic so I guess it is the only one available 版本控制系统:每个人都使用Apple Generic,所以我猜它是唯一可用的

Versioning Username: What is it ? 版本控制用户名:这是什么?

There are other settings like the "Framework Version" in the "Packaging" section that should always use "A" I guess on iOS (since they are actually static frameworks, the version does not matter) ? 还有其他设置,比如“打包”部分中的“框架版本”,我想在iOS上总是使用“A”(因为它们实际上是静态框架,版本并不重要)? And for the "Compatibility Version" / "Current Library Version" settings of the "Linking" section, should I configure them on the static library target only ? 对于“链接”部分的“兼容版本”/“当前库版本”设置,我应该仅在静态库目标上配置它们吗? or are they used by the application linking the library ? 或者它们是否被链接库的应用程序使用?

Unless you're building a commercial, closed-source framework, I would really recommend using CocoaPods . 除非你正在构建一个商业的闭源框架,否则我真的建议使用CocoaPods It will take care of dependencies, resources, versioning, update, installation, etc. All big headaches as your library changes over time. 它将负责依赖性,资源,版本控制,更新,安装等。随着时间的推移,您的库会随之发生变化。

Even if you want to distribute binaries-only for closed-source code you could build the binaries with CocoaPods and then distribute them with a different podspec. 即使您只想为闭源代码分发二进制文件,您也可以使用CocoaPods构建二进制文件,然后使用不同的podspec进行分发。 Also you'll avoid embedding other libraries code which is a really bad but common practice. 此外,您将避免嵌入其他库代码,这是一个非常糟糕但常见的做法。

As for versioning you can check here . 至于版本控制,你可以在这里查看


Going back to making the static library... 回到制作静态库......

The version is not visible from the App and would be merely documentation, thus I think you should add it to all your targets. 该应用程序无法看到该版本,仅仅是文档,因此我认为您应该将其添加到所有目标中。 If you really want to be able to detect the version of your library at runtime you'll need to come up with a class method or global variable like [MyLibrary version] . 如果您真的希望能够在运行时检测库的版本,则需要提供类方法或全局变量,如[MyLibrary version]

Documentation for those keys is included in Xcode or you can just select one and check the the "Quick Help" pane: 这些密钥的文档包含在Xcode中,您只需选择一个并检查“快速帮助”窗格:

在此输入图像描述

Apple has pretty extensive documentation for building and distributing frameworks. Apple拥有非常广泛的文档来构建和分发框架。

The Framework Programming Guide covers most of the ground you need. 框架编程指南涵盖了您需要的大部分基础。 If you want more specific information on how the developer tools use the information in your project, look at the manual page for agvtool , the tool that Xcode uses with the apple versioning system. 如果您想了解有关开发人员工具如何使用项目中信息的更多具体信息,请查看agvtool的手册页,这是Xcode与Apple版本系统一起使用的工具。

You should also be interested in the Coding Guidelines For Cocoa , which also covers some best practices for frameworks. 您还应该对Cocoa Coding Guidelines感兴趣,它还涵盖了框架的一些最佳实践。

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

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