I'm trying to build a universal binary from a static library that works for both ios4 and ios3. However, when I add the library built in ios4 and try to use it in ios3 it gives me these kinds of errors:
Undefined symbols: "_OBJC_CLASS_$_NSMutableCharacterSet", referenced from: objc-class-ref-to-NSMutableCharacterSet in myLib.a(myLib.a-i386-master.o) "_OBJC_CLASS_$_NSURLConnection", referenced from: objc-class-ref-to-NSURLConnection in myLib.a(myLib.a-i386-master.o) "_OBJC_CLASS_$_UIDevice", referenced from: objc-class-ref-to-UIDevice in myLib.a(m开发者_如何学编程yLib.a-i386-master.o) "_OBJC_CLASS_$_NSString", referenced from:
I can't combine the library built in ios3 and ios4 with lipo because they use the same architecture. It looks like it's just not finding some basic files from UIKit. Do I just need to fix some linking issues?
Try weak-linking UIKit. In your build settings right now, it's probably tagged as "Required".
(Right-click target -> Get Info -> General tab -> Linked Libraries -> "Type" column for UIKit.framework)
Just make sure all code paths used by an iOS 3 build aren't using iOS 4.x-only stuff.
Have you tried adding
#import <UIKit/UIKit.h>
...to the top of your class .h file? That might fix the problem.
Andy
精彩评论