Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Versioning Build Settings on frameworks

I am working on an iOS framework based on the following template : 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. 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 ? or 1.2.3 ? or 1.2.3.4 ?

Generated Versioning Source Filename => The name of the .c file generated that contains the integer build number I guess ?

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

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) ? 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 ?

like image 532
LiohAu Avatar asked Dec 03 '13 14:12

LiohAu


2 Answers

Unless you're building a commercial, closed-source framework, I would really recommend using 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. 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].

Documentation for those keys is included in Xcode or you can just select one and check the the "Quick Help" pane:

enter image description here

like image 122
Rivera Avatar answered Oct 08 '22 04:10

Rivera


Apple has pretty extensive documentation for building and distributing frameworks.

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.

You should also be interested in the Coding Guidelines For Cocoa, which also covers some best practices for frameworks.

like image 23
quellish Avatar answered Oct 08 '22 04:10

quellish