Search code examples
iosairios-simulatorair-native-extensionane

NSInvalidArgumentException while running Adobe Air app with native extension on ios


I have compiled ANE plugin with external Obj-C dependencies:

<platform xmlns="http://ns.adobe.com/air/extension/18.0">
    <description>iPhone platform description</description>
    <sdkVersion>8.4</sdkVersion>
    <linkerOptions>
        <option>-ios_version_min 7.0</option>
        <option>-framework Foundation</option>
        <option>-weak_framework AdSupport</option>
        <option>-framework AVFoundation</option>
        <option>-framework AudioToolbox</option>
        <!--option>-framework CoreTelefony</option-->
        <option>-framework CoreGraphics</option>
        <option>-framework EventKit</option>
        <option>-framework EventKitUI</option>
        <option>-framework MessageUI</option>
        <option>-weak_framework StoreKit</option>
        <option>-framework SystemConfiguration</option>
        <option>-framework CoreLocation</option>
        <option>-framework UIKit</option>
        <option>-framework Social</option>
        <option>-framework WebKit</option>
        <option>-framework CoreMedia</option>
        <option>-framework MediaPlayer</option>
        <option>-framework QuartzCore</option>
        <option>-framework CoreImage</option>
        <option>-framework CoreFoundation</option>
        <option>-framework CFNetwork</option>
        <option>-lc++</option>
        <option>-lz</option>
        <option>-lsqlite3</option>
        <option>-lxml2.2</option>
    </linkerOptions>
    <packagedDependencies>
        <packagedDependency>MyStatic.framework</packagedDependency>
    </packagedDependencies>
</platform>

ANE plugin compiles without any exception. When i trying to run sample AIR app on iOS simulator i get this:

$> adt -installApp -platform ios -platformsdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -device ios-simulator -package out/production/sample/Sample.ipa

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: MCMMetadataIdentifier)'
*** First throw call stack:
(
0   CoreFoundation                      0x00007fff8c9f703c __exceptionPreprocess + 172
1   libobjc.A.dylib                     0x00007fff8c44776e objc_exception_throw + 43
2   CoreFoundation                      0x00007fff8c8ddc66 -[__NSDictionaryM setObject:forKey:] + 1174
3   isb                                 0x00000001021f8433 -[iPhoneSimulator createMetaDataPList:withID:] + 314
4   isb                                 0x00000001021f8bff -[iPhoneSimulator installApp:sdkRoot:] + 742
5   isb                                 0x00000001021f9b40 -[iPhoneSimulator runWithArgc:argv:] + 1275
6   isb                                 0x00000001021f9e35 main + 101
7   libdyld.dylib                       0x00007fff941485c9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
/var/folders/7y/7xytqjbx5wggzc246fwrv1zm0000gq/T/cmd6670868742567092003.tmp: line 1: 19356 Abort trap: 6
        "/Users/ewgenius/Documents/flex_sdk_4.6/lib/aot/bin/isb/isb" "-install" "-apppath" "/var/folders/7y/7xytqjbx5wggzc246fwrv1zm0000gq/T/7239e3f7-d560-4f18-8d66-674f841b4a0f/Payload/Sample.app" "-sdkpath" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk"

But when i compile ANE plugin without MyStatic.framework and it's dependencies, sample app is running well. Any ideas?


Solution

  • I found the solution. Packaged dependency MyStatic.framework have Resources folder, and i copied the entire folder to ios directory for build command adt package -target ane -platform iPhone-ARM -C ios/ . -platformoptions ../build/platformios.xml. When i move all files from ios/Resources to ios/ i was able to run my app without exception.