NSInvalidArgumentException 而 运行 Adob​​e Air 应用程序在 ios 上具有本机扩展

NSInvalidArgumentException while running Adobe Air app with native extension on ios

我编译了带有外部 Obj-C 依赖项的 ANE 插件:

<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 插件编译无任何异常。当我尝试在 iOS 模拟器上 运行 示例 AIR 应用程序时,我得到了这个:

$> 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"

但是当我在没有 MyStatic.framework 的情况下编译 ANE 插件及其依赖项时,示例应用 运行 运行良好。有什么想法吗?

我找到了解决方案。打包依赖 MyStatic.framework 有 Resources 文件夹,我将整个文件夹复制到 ios 目录用于构建命令 adt package -target ane -platform iPhone-ARM -C ios/ . -platformoptions ../build/platformios.xml。当我将所有文件从 ios/Resources 移动到 ios/ 时,我能够毫无例外地 运行 我的应用程序。