Some background - I've built a custom Framework using Diney's guide at http://db-in.com/blog/2011/07/universal-framework-iphone-ios-2-0/
Its built for both armv6 / armv7 , its an ARC-based framework, compiled with a depolyment target of 4.3.
When i put the resulting framework in a 5.0 project it works great, but when i put it in a 4.3 project (ARC or non-arc, doesnt matter), i get the following which i can't really understand ...
I've also tried adding libarclite.a manually but it didn't change anything.
ld: duplicate symbol _objc_retainedObject in /Users/freak4pc/Project/MyFramework.framework/MyFramework and /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/arc/libarclite_iphoneos.a(arclite.o) for architecture armv7 Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
Would appreciate any help on this.
Thanks
Shai
I'm struggling with the same problem. The workaround is so set the deployment target of your framework to iOS5 (check if that doesn't make other problems though).
Then you must use ARC in the master project if targeting iOS4, else libarclite will be missing. My solution will be to supply two frameworks, depending if they use ARC or not.
Here's two links to Apple's dev forum with a little bit more info: https://devforums.apple.com/message/539344#539344
https://devforums.apple.com/message/588316#588316
Update: There is a better way. Just build your static library with iOS5 minimum target, and manually add /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/arc/libarclite_iphoneos.a (and /Developer/usr/lib/arc/libarclite_iphonesimulator.a) if your project is not using ARC and needs iOS4-support.
Update 2: Actually, just use the linker flag -fobjc-arc ; this will link libarclite with the library if it's not already in there. Best solution.
Wow that was a hard ride but i finally solved it!
What sparked the final idea was @steipete's comment , Its a bit of a complex situation so i'll try to explain it for anyone who might've crossed this issue as well.
NSJSONSerialization
, otherwise it would fall back to any imported JSON library such as JSONKit
. NSJSONSerialization
, which will cause an exception on 4.3 projects, meaning you would have to manually look for the compile directions and remove the calls to NSJSONSerialization
before compiling, so it would automatically fall back to the 4.3-compatible library (in my case JSONKit
) . That compilation condition is found on AFHTTPClient.m and AFJSONRequestOperation.m (e.g. #if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_4_3 || __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_6
)Hope this would help anyone else who might struggle with this for a couple of days like myself :)
Shai.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With