AIR iOS Framework Linking issues
Hi everyone.
I have an issue with running my app on older version of iOS (specifically iOS 4.x). It runs perfectly fine on iOS 5.x but crashes instantly when it launches on iOS 4.x. I have narrowed it down to how the iOS frameworks are linked. Every site I looked at on this issue points towards how the Frameworks are linked and native extensions (which I am using).
My app has a native extension that I built for a 3rd party library. This 3rd party library uses some features that are specific to the iOS 5 SDK. Right now its crashing with this error:
Symbol not found: _OBJC_CLASS_$_NSFileVersion
According to the iOS documentation, NSFileVersion was introduced for iOS 5 into the Foundations Framework.
The 3rd party library has a list of Frameworks that it requires and specifies how they should be linked (either Required/strong or Optional/weak) in Xcode. The Foundations.framework is one of the frameworks the 3rd party library needs to be weak/optionally linked in Xcode. I also set the iOS Deplotment target to iOS 4.2 (for Game Center support). It builds fine and all that. In the -platformoptions XML file when I build the ANE file with adt, I specifiy the frameworks needed by the 3rd party library. I also specify the sdkVersion as 5.0, the -ios_version_min as 4.2 (again for Game Center support). Here is the options.xml file:
<platform xmlns="http://ns.adobe.com/air/extension/3.1">
<sdkVersion>5.0</sdkVersion>
<linkerOptions>
<option>-ios_version_min 4.2</option>
<option>-framework Foundation</option>
<option>-framework AddressBook</option>
<option>-framework CoreLocation</option>
<option>-framework SystemConfiguration</option>
<option>-framework CoreGraphics</option>
<option>-framework CFNetwork</option>
<option>-framework MobileCoreServices</option>
<option>-framework QuartzCore</option>
<option>-framework StoreKit</option>
<option>-framework Security</option>
<option>-framework UIKit</option>
<option>-framework GameKit</option>
<option>-framework MessageUI</option>
<!-- excluded the 3rd party library name -->
<option>-L/path/to/third/party/library/</option>
<option>-lthrid-party-library</option>
</linkerOptions>
</platform>
It seems to me that the list of the frameworks listing in the -platformoptions XML file are being strong linked into the App when I make a build for iOS devices in Flash Builder. I tried it with another Framework that was introduced in iOS 5 SDK (the Twitter framework). I added the Framework to Xcode, set it to Optional/weak. Added the <option>-framework Twitter</option> to my platform options XML file and rebuilt evertyhign. it was crashing when launching on an iOS 4.x device with this error:
Library not loaded: /System/Library/Frameworks/Twitter.framework/Twitter
So it seems that these frameworks in the options XML file are being strongly linked when building for the device. I am using Flash Builder 4.6, AIR SDK v3.2, Xcode 4.3.2, iOS 5.1 SDK and on a Mac.
Does anyone have any idea how to make certain Frameworks be weakly linked when building a native extension? I've been searching around online for a while and have not found any information about it, or other people experiencing the same problem.
Any information on this issue would be really helpful.
