我一直在寻找一种方法来将 buildDate 和 buildNumber 添加到我的项目(我发现了),但我有点困惑,大多数人建议将属性添加到 info.plist
调用CFBuildDate
和 CFBuildNumber
。
编辑:
这些属性是否以 CF 开头,因为:
- 他们属于 Core Foundation,这就是惯例?
- 它们不是 CF 的一部分,但惯例还是要使用 CF?
- 它们可以被称为任何东西,CF 只是让它们相互匹配 CF 键?
- 没关系,随便叫他们什么。
最佳答案
当我问自己这个问题时,我从 something similar to this post 得到了我的原始信息。其中讨论了使用 CFBuildNumber
和 CFBuildDate
并提供了一些巧妙的脚本创意来生成它们。
经过彻底搜索后,我找不到任何关于在任何 iOS 项目或最近的 OSX 项目中使用 CFBuildNUmber
/CFBuildDate
的官方 Apple 文档。 The Information Property List Key Reference (Core Foundation Keys)也没有提及它们,所以我的结论是它们不是官方的,只是使用 CF 作为前缀以类似于现有的 Core Foundation key 。
对于您的问题,我相信 #2、#3 和 #4(正如您所怀疑的)是由于缺少关于这两个 key 的任何官方 Apple 文档。
- They are not part of CF; the convention is to use CF anyway.
- They can be called anything; CF just makes them match the other CF keys.
- Their name doesn't matter, they can be called what you want.
我不能代表 OSX 开发,但从 iOS 方面来看,为这些目的提供的两个键是 CFBundleShortVersionString
和 CFBundleVersion
。前者是简短的 App Store 可见版本,后者是根据需要添加数字的扩展版本。
我使用由 CI 服务器生成的内部版本号,并在编译时将其附加到 CFBundleVersion
键的末尾。如果您想添加日期,您可以将其添加到同一个键中。
关于iphone - buildDate 和 buildNumber 的 plist 属性名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12406854/