Symptoms:

Our project needed the ANE QR code scanning feature. After writing it in XCode with ZBarSDK and publishing it as an ANE, packing it into an IPA with adt threw this error:

Packaging failed! Packaging error message: Compilation failed while executing : ld64 Packaging output: ld: warning: ignoring file /var/folders/l5/kql7svqx5j93vwg65tj3pt_c0000gn/T/8e0d5504-ffea-41da-a45b-22cfe260a197/libcn.flashj.ane.ios.QRScan.a, file was built for archive which is not the architecture being linked (armv7): /var/folders/l5/kql7svqx5j93vwg65tj3pt_c0000gn/T/8e0d5504-ffea-41da-a45b-22cfe260a197/libcn.flashj.ane.ios.QRScan.a Undefined symbols for architecture armv7: “_QRScanExtInitializer”, referenced from: _g_com_adobe_air_fre_fmap in extensionglue.o (maybe you meant: _QRScanExtInitializer_name) “_QRScanExtFinalizer”, referenced from: _g_com_adobe_air_fre_fmap in extensionglue.o (maybe you meant: _QRScanExtFinalizer_name) ld: symbol(s) not found for architecture armv7

At first I thought some project setting in XCode was wrong, and suspected libiconv wasn’t added correctly under “Link Binary With Libraries”, but after checking carefully it was fine, and all the required source files were already included in the target.

Eventually I found the solution:

Any ANE developed with external libraries needs an XML file that declares the external libraries it uses, like my platformoptions.xml here:

An optional description
2012 (optional)

    \-liconv 

And add -platformoptions platformoptions.xml to the adt packaging parameters. Add -platformoptions platformoptions.xml to the adt packaging parameters and you’re done.

By the way, here’s a great tool that works wonders for writing ANEs for iOS: XCode-template-ane.
It’s an XCode template — just set the path to the SWC with the interface you use to generate the ANE and the AIR SDK path, and all that’s left is writing OC code. It handles the adt packaging steps for you and generates the ANE automatically in one click.