Reputation: 795
I'm trying to make a c# binding for "iCarousel" objective-c library. I've created a new target "Cocoa Touch Static Library" for the Xcode project and i've created the static libraries after that using the tutorial commands:
/Developer/usr/bin/xcodebuild -project iCarousel.xcodeproj -target libiCarousel -sdk iphonesimulator -configuration Release clean build
/Developer/usr/bin/xcodebuild -project iCarousel.xcodeproj -target libiCarousel -sdk iphoneos -arch armv6 -configuration Release clean build
/Developer/usr/bin/xcodebuild -project iCarousel.xcodeproj -target libiCarousel -sdk iphoneos -arch armv7 -configuration Release clean build
lipo -create -output libiCarousel.a libiCarousel-i386.a libiCarousel-armv6.a libiCarousel-armv7.a
Everything worked like a charm for now. After that I've created a new monotouch binding project, include the "fat" static library, generated a dll using the new LinkWith attribute and everything it's working fine on the simulator and on my iPad with iOS 5.0.
The problem only appears on my old iPhone 3g with iOS 4.1 installed. The sample I've made doesn't run and the debugger returns this strange error:
dyld: lazy symbol binding failed: Symbol not found: _objc_retainAutoreleasedReturnValue Referenced from: /var/mobile/Applications/8160D667-16EF-45F7-9658-A096AD421A21/Sample.app/Sample Expected in: /usr/lib/libobjc.A.dylib
dyld: Symbol not found: _objc_retainAutoreleasedReturnValue Referenced from: /var/mobile/Applications/8160D667-16EF-45F7-9658-A096AD421A21/Sample.app/Sample Expected in: /usr/lib/libobjc.A.dylib
I'm almost sure it's an error on my Xcode project properties and with ARMv6 and ARMv7 settings but I don't know how to handle it.
Update: I've used LinkWith like this: [assembly: LinkWith ("libiCarousel.a", LinkTarget.Simulator | LinkTarget.ArmV6 | LinkTarget.ArmV7, ForceLoad = true, Frameworks="CoreGraphics QuartzCore UIKit")]
Update: I noticed that my build it's working ONLY on iOS 5.
Answer:
Okay guys, I've made it!
So, the ideea is that I had to modify the "achitectures" value in the project settings to support armv6, and add to all header files the "-fno-objc-arc" compile flag.
I wrote a tutorial for this, step by step, hope it will help all the monotouch fans out there.
http://dantes-andreea.blogspot.com/2012/01/how-to-use-objective-c-library-in.html
Upvotes: 1
Views: 1276
Reputation: 795
Okay guys, I've made it!
So, the ideea is that I had to modify the "achitectures" value in the project settings to support armv6, and add to all header files the "-fno-objc-arc" compile flag.
I wrote a tutorial for this, step by step, hope it will help all the monotouch fans out there.
http://dantes-andreea.blogspot.com/2012/01/how-to-use-objective-c-library-in.html
Upvotes: 2
Reputation:
Suppose I should put this in an answer, though it may be wrong. Alright, what this looks like is that you've got an incompatibility between iOS SDK versions. On the one hand, your library looks like it's being built for iOS 5, which means it's probably getting the full ARC treatment and all that. What I don't know is whether the compiled results differ between iOS 4 and 5 when using ARC, so take this with a grain of salt.
At any rate, if you've built with ARC support but targeted iOS 5.0 as the minimum SDK, it may have become incompatible with iOS 4.1 by applying some tricks or other that work perfectly fine on iOS 5 but are not supported on iOS 4 (again, I know nothing about how this works out, so you should be bathing in salt by now). Hard to tell, since I've never encountered this, but that seems like a decent guess. You might want to try rebuilding your library and target an earlier version of the SDK.
Upvotes: 0