Objective-C static libraries and categories
If you are building iPhone or other Mac apps with the iPhone using static libraries, reading
Technical Q&A QA1490 will help you. I was getting a problem running with FMDB because it uses categories to extend the functionality of one of its classes and failing at runtime with a selector problem.
To resolve this issue, the static library should pass the -ObjC option to the linker. This flag causes the linker to load every object file in the library that defines an Objective-C class or category. While this option will typically result in a larger executable (due to additional object code loaded into the application), it will allow the successful creation of effective Objective-C static libraries that contain categories on existing classes.
In my case I had to put these flags on the primary application target (the one using the library) rather than the library itself, which strikes me as odd.
| Permalink | Comments[3] |
Related Items
Recent Entries
» iTunes 8 on Windows XP x64
» iPhone SDK Code Signing Insights
» Making iPhone Distribution Profiles Show Up
» Objective-C static libraries and categories
» A fix for Textile on Wordpress
You can skip to the end and leave a response. Pinging is currently not allowed.
August 26th, 2008 at 8:37 am
Great Tip!
September 13th, 2008 at 11:01 am
You made my day!