BugSense for iOS is built as a statically-linked framework, which means that at its heart, it is essentially a static library. The difference between the two is the organized structure that a framework has. Frameworks are bundles of compiled code, headers and resources. Static libraries are just compiled code. With static libraries, everything else (including the header files) you must distribute separately.
The advantage of making a framework is that it makes life a lot easier for our users. You just add the framework in your project and you’re good to go. We can bundle images and XIB files without making installation more complex.
There is no project template for static frameworks for iOS in Xcode
In order to create a framework for iOS, there are two approaches. The hardest one, is to take one of the existing template for Mac OS X, convert it so that it makes an iOS framework instead and provide a script to make it work for both the device and the simulator (build a ‘universal’ framework). This assumes that you have the necessary skills and time to indulge in some sophisticated hacking.
However, time is a precious commodity and there is a better approach. [Karl Stenerud](https://github.com/kstenerud) made an immensely valuable set of project templates for Xcode: [iOS-Universal-Framework](https://github.com/kstenerud/iOS-Universal-Framework). When installed, it lets you choose to make a statically-linked framework for iOS, like you would for Mac OS X.
Having tried the former approach first, the template-based one is a far better solution. It is very easy to make the transition of any existing projects to the new project type. The only downside to it is that the source code is not as portable; to build the framework you need to have the template installed in your computer. The reason is that the template introduces a few additional values for various configuration settings, that don’t originally exist in Xcode.
Moving to iOS 5 / Xcode 4.2 broke things
Xcode 4.2 gently guides developers to using armv7 (and forgoing support for armv6). The changes in how the ARCHS (Architectures) configuration property and the $(ARCHS_STANDARD_32_BIT) constant work, made it impossible to build the framework with simulator support at first. armv6 and iphonesimulator to make a build would not work together anymore! In previous versions of Xcode, the ARCHS setting would be valid for both the iphoneos and iphonesimulator platforms.
To fix this, it was necessary first to add i386 to VALID_ARCHS (Valid Architectures). In the build script, I set ‘i386’ as the architecture for the simulator: