2 Replies Latest reply on Jan 14, 2013 5:43 AM by DaveGallant

    Air 3.5 iOS Native Extension - Undefined symbols for architecture armv7

    DaveGallant Level 1

      I am trying to create a native extension to interface with a 3rd party SDK that was designed for iOS. I have built this extension before, but recently the 3rd released an update to their sdk and I took this opportunity to clean up my native extension code. Up until  now though, it was all built using xCode 4.2 for the iOS 5.1 SDK

       

      I setup a static library project in xCode 4.5.3

       

      The architectures is set to Standard (Armv7, Armv7s)

      The base SDK is iOS 6.0 (I have managed to download and install the 5.1 sdk and I tried that too)
      Compiler for c/c++/obj-c: LLVM GCC 4.2

      iOS Deployment Target: 4.3

      Other Linker Flags: -objC

      Enable Linking with Shared Libraries: true

       

      In the build Phase I have the following Link Binary With Headers:

      libicucore.dylib

      UIKit.framework

      libz.dylib

      CoreData.framework

      Foundation.framework

      iAd.framework

      SystemConfiguration.framework

      StoreKit.framework

      MessageUI.framework

      CoreGraphics.framework

      GameKit.framework

      libWebp.a

      libFlurryAnalytics.a

       

      When I build the library, I don't get any errors.

       

      this is my extensions.xml file:

       

      <extension xmlns="http://ns.adobe.com/air/extension/3.5">

        <id>com.bigfishgames.nativeextensions.ios.BFGlibNativeExtension</id>

        <versionNumber>1</versionNumber>

        <platforms>

          <platform name="iPhone-ARM">

              <applicationDeployment>

                  <nativeLibrary>libBFGlibNativeExtension.a</nativeLibrary>

                  <initializer>BFGlibNativeExtensionIOSExtInitializer</initializer>

                  <finalizer>BFGlibNativeExtensionIOSExtFinalizer</finalizer>

              </applicationDeployment>

          </platform>

          <platform name="default">

            <applicationDeployment/>

          </platform>

        </platforms>

      </extension>

       

      I have made sure that the initializer and finializer functions are indeed present in the primary .m file of my native code in the static library.

       

      This is the my platformOptions.xml:

       

      <platform xmlns="http://ns.adobe.com/air/extension/3.5">

          <sdkVersion>5.0</sdkVersion>

          <linkerOptions>

              <!-- to link with the libicucore.dylib -->

              <option>-licucore</option>

           </linkerOptions>

      </platform>

       

       

      When I build the ANE, this is my command line:

       

      ${ADT} -package -storetype PKCS12 -keystore "${CERT_NAME}" -storepass threed -tsa none \

          -target ane ${ANE_NAME} ${XML_NAME} \

          -swc ${SWC_NAME} \

          -platform iPhone-ARM "library.swf" ${SL_NAME} -platformoptions ${PLATFORM_OPTIONS} \

          -platform default "library.swf"

       

      I also don't get any errors.

       

      So then it comes time to compile my example app. I have created all the certificate and provisioning profile files and all that jazz... I can successfully build and deploy the app to my iPhone for testing without any native extensions included.

       

      In my Flash Builder 4.6 project, I add the native extension to the build path/native extension options.

      I then exported the .swf and the application descriptor file - which has the native extension defined in it.

       

      I then run ADT using the following command line

       

      ${ADT} -package \

          -target ipa-test-interpreter \

          -storetype pkcs12 \

          -keystore "${CERT_FILE}" \

          -storepass "${CERT_PASS}" \

          -provisioning-profile "${PROV_FILE}" \

          "../${IPA_FILE}" \

          "${XML_FILE}" \

          "${SWC_FILE}" \

          "bfgads_bundlepackage.zip" "bfgbranding_resources.zip" "bfgrating.bfgstrings" "bfgpromodashboard_gamespecific.zip" "bfg_default_settings.json" \

          "bfgpromodashboard-ipad.nib" "bfgpromodashboardMoreGames-ipad.nib" "bfgpromodashboard.nib" "bfgpromodashboardMoreGames.nib" "bfgpromodashboardSkinned-ipad.nib" "bfgpromodashboard_resources.zip" "bfgsplash_resources.zip" \

          "Default@2x~iphone.png" "Default~iphone.png" "Default-Landscape.png" "Default-Portrait.png" "Default-iPhone-Landscape.png" \

          -extdir "extensions" \

          -platformsdk "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iP honeOS6.0.sdk"

       

      And this is what I get:

       

      Running ADT version:

      3.5.0.840

       

      Undefined symbols for architecture armv7:

        "_OBJC_CLASS_$_MFMailComposeViewController", referenced from:

            objc-class-ref in libcom.bigfishgames.nativeextensions.ios.BFGlibNativeExtension.a(bfgMoreGamesMailControll er.o)

            objc-class-ref in libcom.bigfishgames.nativeextensions.ios.BFGlibNativeExtension.a(bfgSplashMailController. o)

        "_OBJC_CLASS_$_ADBannerView", referenced from:

            objc-class-ref in libcom.bigfishgames.nativeextensions.ios.BFGlibNativeExtension.a(iadLoader.o)

            objc-class-ref in libcom.bigfishgames.nativeextensions.ios.BFGlibNativeExtension.a(bfgadsView.o)

        "_OBJC_CLASS_$_SKProductsRequest", referenced from:

            objc-class-ref in libcom.bigfishgames.nativeextensions.ios.BFGlibNativeExtension.a(bfgPurchase.o)

        "_OBJC_CLASS_$_GKLocalPlayer", referenced from:

            objc-class-ref in libcom.bigfishgames.nativeextensions.ios.BFGlibNativeExtension.a(bfgutils.o)

        "_OBJC_CLASS_$_SKPayment", referenced from:

            objc-class-ref in libcom.bigfishgames.nativeextensions.ios.BFGlibNativeExtension.a(bfgPurchase.o)

        "_ADBannerContentSizeIdentifierPortrait", referenced from:

            -[iadLoader beginLoadAd] in libcom.bigfishgames.nativeextensions.ios.BFGlibNativeExtension.a(iadLoader.o)

        "_OBJC_CLASS_$_SKPaymentQueue", referenced from:

            objc-class-ref in libcom.bigfishgames.nativeextensions.ios.BFGlibNativeExtension.a(bfgPurchase.o)

      ld: symbol(s) not found for architecture armv7

      Compilation failed while executing : ld64

       

      Done.

       

      I have tried compiling it targetting the iOS 5.1 sdk and it made no difference.

       

      Now, here is the interesting thing. If I include a native extension I wrote a year or so ago... everything compiles and works. But if i take that "old" extension out, I get the above.

      The old extension was written for Air 2.5 and was nothing but a simple "alert view" extension - was my very first "hello world" native extension.

       

      As I test, I recompiled my alert view extension using air 3.5 and xcode the same way I am building the current extension. When I add the "new" alert view extension to the project, the above error returns. But if I put the old alert view extension in, it goes away... since I can't release the current extension with my old alert view as a dependency, I need to figure out why the above error is happening.

       

      Any ideas on how to fix this?