Air Native Extension for OS X. Cant call functions from native code.

Hi, I am trying to build native extension for OS X.
After creating context, I try to call native function with "call" method, but always I have an error "The extension context does not have a method with the name ..."
In as3 code my ExtensionContext is not null, so it's okay. And in native objective-c code I have a function, which I call in as3 code.
What should I do?
Here my code.
Objective-c:
FREContext AirContext = nil;
    FREObject init(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[])
        return nil;
    FREObject someFunction(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[])
        FREDispatchStatusEventAsync(AirContext ,(uint8_t*) "SOME_EVENT", (uint8_t*) "some information" );
        return nil;
    void ANEContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet)
        NSLog(@"Entering ContextInitinalizer()");
        *numFunctionsToTest = 5;
        FRENamedFunction* func = (FRENamedFunction*) malloc(sizeof(FRENamedFunction) * *numFunctionsToTest);
        func[0].name = (const uint8_t*) "init";
        func[0].functionData = NULL;
        func[0].function = &init;
        func[1].name = (const uint8_t*) "someFunction";
        func[1].functionData = NULL;
        func[1].function = &someFunction
        // other blank functions
        *functionsToSet = func;
        AirContext = ctx;
        FREDispatchStatusEventAsync(AirContext ,(uint8_t*) "SOME_EVENT", (uint8_t*) "some information" );
    void ContextFinalizer(FREContext ctx) {
        NSLog(@"Entering ContextFinalizer()");
        NSLog(@"Exiting ContextFinalizer()");
    void ANEInitializer(void** extDataToSet, FREContextInitializer* ctxInitializerToSet, FREContextFinalizer* ctxFinalizerToSet )
        NSLog(@"Entering ExtInitializer()");
        *extDataToSet = NULL;
        *ctxInitializerToSet = &ContextInitializer;
        *ctxFinalizerToSet = &ContextFinalizer;
        NSLog(@"Exiting ExtInitializer()");
    void ANEFinalizer(void* extData)
        return;
ActionScript3:
public class MyANE extends EventDispatcher{
        private static var _instance:MyANE;
        private var extCtx:ExtensionContext;
        public function MyANE()
            if (!_instance)
                if (this.isSupported)
                    extCtx = ExtensionContext.createExtensionContext("my.awesome.ane", null);
                    if (extCtx != null)
                        trace('context is okay'); //this trace works
                        extCtx.addEventListener(StatusEvent.STATUS, onStatus);
                    } else
                        trace('context is null.');
            _instance = this;
            else
                throw Error('singleton');
    public static function getInstance():MyANE
            return _instance != null ? _instance : new MyANE();
    public function get isSupported():Boolean
            var value:Boolean = Capabilities.manufacturer.indexOf('Macintosh') > -1;
            trace(value ? 'supported' : 'not supported ');
            return value;
    private function onStatus(event:StatusEvent):void
            trace('Event', event, 'code', event.code, 'level', event.level); //this traсе does not works
     private function test(): void
          extCtx.call("someFunction"); //this throws error
XML:
    <extension xmlns="http://ns.adobe.com/air/extension/3.9">
        <id>my.awesome.ane</id>
        <versionNumber>1.0.0</versionNumber>
        <platforms>
            <platform name="MacOS-x86">
                <applicationDeployment>
                    <nativeLibrary>MyANE.framework</nativeLibrary>
                    <initializer>ANEInitializer</initializer>
                    <finalizer>ANEFinalizer</finalizer>
                </applicationDeployment>
            </platform>
        </platforms>
    </extension>
And this script Im using for build ANE:
    mv ../as3/bin/MyANE.swc .
    unzip MyANE.swc
    mv library.swf mac/
    rm catalog.xml
    rsync -a ../Obective-C/ANE/Build/Products/Debug/ANE.framework/ mac/ANE.framework/
    adt -package -target ane MyANE.ane extension.xml -swc MyANE.swc -platform MacOS-x86 -C mac .
    mv MyANE.ane ~/Work/_Projects/test/libs-ane/

I haven't done Objective C in a long time, but if I'm not mistaken, it requires the semicolon to terminate a line of code. The line containing "func[1].function = &someFunction" does not have that termination and since that is the function you are trying to execute, maybe that is the source of the error.

Similar Messages

  • External library inside Air native extension for android

    Hello everyone,
    First, I've been looking throught this topics
    - http://stackoverflow.com/questions/7732742/air-3-native-extensions-for-android-can-i-how-t o-include-3rd-party-libraries
    - http://stackoverflow.com/questions/24626380/how-to-include-additional-jar-in-android-nativ e-extension-for-adobe-air-mobile
    I got a similar problem. But not exactly the same. And the solution didn't worked for me :(.
    First of all, I don't have any visible error.
    -I can easily talk between java and action script.
    -The gateway is set without problems.
    My problem comes when, from my java-side-part of the extension, I try to call a 3rd party library. This library is (and I think this is where I do something  wrong) linked to my project as an external lib, in .jar format.
    So when I make a call to 3rd party library, it just doesn't print anything. Neither on the adobe part or on the java part. The logs that are before my call are printed but not the ones after.
    I tried different solutions that are:
    -Taking all compiled class files of my external lib and add it inside the main native extension jar [link1]
    same result (no errors)
    -including the 3rd party jar inside the ANE by adding a dependence file that require the .jar [link2]
    with this method i got this error that I don't get
    > aapt tool failed:ERROR: input directory '--auto-add-overlay' does not exist
    My third party library also include's itself some external .jars so do I need to include every jars inside the same packaged jar?
    I can see that a lot of people are dealing with issues like that so my question would be:
    What is the best way to include 3rd party library inside android AIR Native Extension ?.
    For information, here is what I do to create the ANE
    >adt -package -target ane AirInfinitGameANE\AirInfinitGame.ane AirInfinitGameASLib\src\extension.xml -swc AirInfinitGameANE\AirInfinitGameASLib.swc -platform Android-ARM -C AirInfinitGameLib .
    - AirInfinitGameASLib: just the folder with the actionScript part and the config xml file
    - AirInfinitGameANE: folder in the one that will be the native extension
    - AirInfinitGameLib: the eclipse java project. I need to put in that folder the airInfinitgamelib.jar(extension jar) and the library.swf (from the swc file) in order to beeing able to compile the ANE.
    Here it is ! Thanks a lot for thoses who'll read me.

    I had the same problem recently and fixed it as follows;
    - Extract the 3rd party jar file and copy the class folder (usually named "com" in the root of the jar) to my project.
    - Under Project Properties -> Java Build Path -> Libraries click "Add class folder" and add the "com" folder you just extracted from your .jar.
    Hope this helps

  • Adobe Air native extension for admob

    Dear Adobe Team,
    We have recently purchased Adobe Air native extension for admob for android & ios
    but every time we upload our app to an ipad or iphone, the app crashes.
    We have carefully followed your instructions, and we're sure we've not made a mistake writing the action script 3 code.
    We need your help in solving this problem urgently, as we are now running behind schedule in uploading our app.
    Thanks very much,
    Amir Steklov and Dorit Leshnick

    Before I was also searched a lot to find good  add network and also Admob.
    Finally we done successfull integration using..  working fine in all IOS devices. not yet released to Apple app store
    http://code.google.com/p/flash-air-admob-ane-for-ios/source/browse/trunk/admobaneiphone/sr c/admobtest.as?r=2
    You can check our add setups using Air ANE's for our android game ExpressTrain.
    https://play.google.com/store/apps/details?id=air.timuzsolutions.expresstrain&feature=sear ch_result#?t=W251bGwsMSwyLDEsImFpci50aW11enNvbHV0aW9ucy5leHByZXNzdHJhaW4iXQ..
    you no need to buyAdobe Air ANE's everything is free but all u need to do is googling,
    hope this will help.
    Bala
    Message was edited by: vamsibalu

  • Developing and using Adobe AIR native extensions for Android devices

    I was using this tutorial:
    "Developing and using Adobe AIR native extensions for Android devices"
    http://www.adobe.com/devnet/air/articles/ane-android-devices.html
    When packing the Flex mobile ANESampleTest to deploy on an Android device, the below error happens
    Error occurred while packaging the application:
    aapt tool failed:invalid resource directory name: /private/var/folders/k8/1thhvkf92h947n_g22hg_v9m0000gn/T/52ba05aa-9001-4d46-9438-db81ef83 06f0/res/drawable-xxhdpi
    invalid resource directory name: /private/var/folders/k8/1thhvkf92h947n_g22hg_v9m0000gn/T/52ba05aa-9001-4d46-9438-db81ef83 06f0/res/values-sw600dp
    invalid resource directory name: /private/var/folders/k8/1thhvkf92h947n_g22hg_v9m0000gn/T/52ba05aa-9001-4d46-9438-db81ef83 06f0/res/values-sw720dp-lan
    Does anyone know what the issue might be?

    Did you find a workaround for the Error? I'm getting the same and I can't seem to find any solution.

  • Native Extension for AIR publishing error : framework not found

    Hello,
    I'm trying to build an iOS app using native extensions for AIR, but when I publish, I've an error message saying : framework not found
    I tried with this ANE for GameCenter integration : https://github.com/StickSports/ANE-Game-Center
    it says " ld: framework not found GameKit "
    Same problem with GREE Platform SDK for AIR :
    https://docs.developer.gree.net/en/globaltechnicalspecs/#sdkforair
    it says " ld: framework not found CoreTelephony "
    The thing is that these frameworks are already included, I guess.
    I'm using flash cs6 on mac, and I've included the path to iOS SDK in the publishing settings.

    Are you using the ANE from there or are you recompiling the ANE at your end?
    If you are recompiling, please make sure that you are using the platform.xml file they have provided.
    If you are using their precompiled ANEs, probably, the path to iOS SDK is not correct. It should be upto the folder iPhoneOSx.y.sdk.

  • In App Purchase Native Extension for Android

    Hi All
      I was wondering whether anyone has done any work on an In App Purchase native extension for Android?  If one does not already exist I am going to be starting work on one shortly. 
      I did a google search and found this stackoverflow post http://stackoverflow.com/questions/8053049/air-native-extensions-for-android-in-app-billin g .  The poster is having difficulty with the call back from the Android market.    One of the responses mentions that 'Native extensions have an issue with java libraries' .  Has anyone else come across this issue and if so how did you fix it? 
    thanks for any help you can provide!
    Mark

    I have just finished a (commercial) extension that lets you directly do in-app purchases on android from Actionscript 3. You can check it out here.

  • Native extension for Game Center

    Hi guys,
    As I understand it with the latest Air Beta it's possible to implement native extensions for iOS, and in theory that would make it possible to connect to both Game Center and in-app purchases.
    Has anyone here tested this? It would be nice to know if there are any show stoppers before I start "digging"...
    Cheers,
    /Andreas

    I just finished an extension for AIR that adds Game Center (commercial.)  I'm going to be doing Multiplayer next.  I'm pretty sure there's an in app purchase one out there, I'm looking for it now, I'll post if i find it.

  • Any good Native extensions for iOS yet?

    Hi,
    I wonder if there are any usable native extensions around yet for iOS features?
    I have only found these: http://www.adobe.com/devnet/air/native-extensions-for-air.html which seems to be mostly tech-demos (battery, network info etc). I thought at least in-app-purchases, Game Center support, iAds, alertbox etc should have been released by now?
    Since I have no knowledge in objective-c I can't do it myself, but I would gladly pay for ANE-files that are usable in real projects.
    /Karl

    http://code.google.com/p/flash-for-mobile/
    qq讨论群:56892018
    version for iphone and ipad https://github.com/lilili87222/admob-for-flash
    this is a actionscript native extension for developer to ad advertisement to their air mobile application run on iphone or android.it very easy to use
    admob for flash android this lib enable you to add admob ad to your flash air application to add native advertisement to your actionscript3 application you just need to do four step
    1.replace D:\Program Files\Adobe\Adobe Flash Builder 4.6\sdks\4.6.1\lib\android\lib\resources\android-res.jar with android-res.jar
    2. add this config to -app.xml
    <android>
    <manifestadditions><![CDATA[
    <manifest android:installLocation="auto">  <uses-sdk android:targetSdkVersion="11"/> <uses-sdk android:minSdkVersion="8"/>  <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <application><!-- <activity android:name="com.google.ads.AdActivity?" android:configChanges="keyboard|keyboardHidden|orientation"/> --> <activity android:name="com.google.ads.AdActivity?" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize |smallestScreenSize"/>
    </application>
    Unknown end tag for </manifest>
    ]]></manifestadditions>
    </android>
    3.add this config to -app.xml
    <extensions>
    <extensionid>so.cuo.ane.Admob</extensionid>
    </extensions>
    4. add code to your android air application like follow 
    test1(); private function test1():void {  var admob:Admob=Admob.getInstance(); if(admob.isSupported){  admob.setUnitId(gid); admob.dispatcher.addEventListener(AdEvent?.onReceiveAd,this.adHandler); admob.dispatcher.addEventListener(AdEvent?.onFailedToReceiveAd,this.adHandler);
    // admob.showRelation(AdMobAlignment?.ALIGN_BOTTOM,AdType?.BANNER); 
    admob.show(50,100,AdType?.BANNER);
    }else{  trace("not support"); }
    protected function adHandler(event:AdEvent?):void {  trace("receive ad"); }

  • How to Call Function from SAPSCRIPT

    I want to Call a function from my SAPSCRIPT to get some data and print the same in the form , Can I get an example for this

    Hi Nandan,
    U cannot directly call function from SAPScript... For that u have to create one include in which u need to write the code. Using Perform... EndPerform u can call the same from SAPScript. See the below example
    u need to write this code in SAPScript
    PERFORM formname IN PROGRAM includename
    USING &field1&                                      
    USING &field2&                                      
    CHANGING &field3&                                     
    ENDPERFORM                                               
    Here includename is your include type program.
    u need to write this code in your include type program..
    FORM formname TABLES in_par STRUCTURE itcsy
                            out_par STRUCTURE itcsy.
    data : var1 like field1,
           var2 like field2,
           var3 like field3.
      READ TABLE in_par WITH KEY 'field1'.
      CHECK sy-subrc = 0.
      var1 = in_par-value.
      READ TABLE in_par WITH KEY 'field2'.
      CHECK sy-subrc = 0.
      var2 = in_par-value.
    now u can call corresponding function using local VAR1 and VAR2. Here u can pass N no of USING parameters.
    After processing on VAR3...
      READ TABLE out_par WITH KEY 'field3'.
      out_par-value = VAR3.
      MODIFY out_par INDEX sy-tabix.
    EndForm.
    Here in_par and out_par are the structures which will be used to communicate with SAPScript. And this is the only way as per my view.
    I m sure this code will work fine. Here i have used dummy variables that u need to change as per your requirement. If u have more queries write me back.
    And yes if this works than dont forget to give the points.
    Regards,
    Sagar

  • Call function from data base with clob input parameter.

    Hello,
    In this project I use Jdev 11g.
    I call function from database.
    create or replace function get_fa_list (
    p_fa_id_list in clob
    return sys_refcursor
    is
    vCursor sys_refcursor;
    begin
    put_msg ('begin');
    if p_fa_id_list is null then
    put_msg ('CLOB is null!');
    else
    put_msg ('size CLOB: ' || dbms_lob.getlength (p_fa_id_list));
    end if;
    put_msg ('Save');
    open vCursor for
    select rownum as id, s.*
    from (
    select f.latitude, f.longitude, count (distinct f.res_id) as res_count, count (*) as fa_count, 16711680 as color, res_concat_distinct (f.res_id) as station_list
    from mv_frequency_assignment f, table (SplitClob (p_fa_id_list, ',')) l
    where f.ext_system = 'BI' and
    f.ext_sys_id = l.column_value
    group by f.latitude, f.longitude
    ) s;
    put_msg ('Open and End');
    return vCursor;
    end get_fa_list;
    I use TopLink in ejb.
    i use follow code for call function and get result.
    public List<TmpResPoints> findAllPointsBI(String p_id){
    UnitOfWork uow = getSessionFactory().acquireUnitOfWork();
    uow.beginEarlyTransaction();
    StoredFunctionCall call = new StoredFunctionCall();
    call.setProcedureName("get_fa_list");
    call.useUnnamedCursorOutputAsResultSet();
    ClobDomain c = new ClobDomain(p_id);
    //System.out.println(c.toString());
    call.addNamedArgumentValue("p_fa_id_list", c);
    ReadAllQuery query = new ReadAllQuery();
    query.setReferenceClass(TmpResPoints.class);
    query.setCall(call);
    List<TmpResPoints> result = (List<TmpResPoints>)uow.executeQuery(query);
    uow.commit();
    uow.release();
    return result;
    But size parameter "p_fa_id_list" is 0. (geting from temp table in Data base). this code in function >>
    if p_fa_id_list is null then
    put_msg ('CLOB is null!');
    else
    put_msg ('size CLOB: ' || dbms_lob.getlength (p_fa_id_list));
    end if;)
    How I can call this function from dataBase and get result?
    thx,
    Demka.

    What is the SQL generated?
    The argument should just be the Clob value (a String) not the domain object.
    Also try addNamedArgument, and then pass the named argument to the query.
    James : http://www.eclipselink.org

  • Send data to ECC table through RFC Call function from SAP B1 via  b1if

    Hi,
    I have created scenario in B1if which triggers from SAP B1, now I have to send this data in to ECC table, so I have created scenario for that with inbound SAP B1, outbound void and in process RFC Call atom is there but I am not getting data in receiver and also how to write xml to send data in RFC function. Function for RFC has configured from ECC end and have access of that function.
    So please help me to send data to ECC table through RFC Call function from SAP B1 (9.0) via b1if
    Thanks

    Solved by my own.

  • Aurasma Native Extension for AIR

    I'm wondering if anyone can help. Aurasma (the Augmented Reality system) supplies a kernel and XCode/Android template files for including their app within your own. Basically, they provide and interface and a library (.a file) so that you can include a button to launch their app overtop of yours. A close button within their app will return you to your own.
    I've made attempts to build this into a Native Extension, so that their app will launch in a native window above the Air app. The process I'm going through right now causes the Flash CS6/Air 3.3 compiler to crash at the end of the compile (resulting in no .ipa being built).
    Before going into too much detail as to what is involved and where things could be going wrong - has anyone had any experience building an app with Aurasma's kernel? Anyone attempted to build a native extension using Aurasma?
    Thanks in advance!

    Are you using the ANE from there or are you recompiling the ANE at your end?
    If you are recompiling, please make sure that you are using the platform.xml file they have provided.
    If you are using their precompiled ANEs, probably, the path to iOS SDK is not correct. It should be upto the folder iPhoneOSx.y.sdk.

  • Facing error#3500 while running AIR native extension for windows

    Hi,
    I am stuck in a problem regarding AIR native extension from couple of days.Whenever I tried to run an extension for windows it gives error code 3500 (extension context cannot have the method ie methodname).I am doing all things correctly but don't know where I lack.I am using Flash Builder 4.6 and 64 bit machine.I made the sample extension POC for android ,they are working fine.No such issue.
    Please post your valuable comments.Eagerly waiting for reply.
    Thanks

    Hi,
    Finally I got the answer to my problem.Actually I dont have the dependency dll of .net framework 4.So I nstall these and now my code is working fine.
    Thanks

  • 64bit AIR Native Extension for iOS

    Hello,
    I created a native extension to support ARM64 for iOS. The problem is I get the following error when packaging an ad-hoc build:
    "Error: libgameCenter.a are required to have universal iOS libraries. Please contact the ANE developer(s) to get the same."
    As I understand I need both armv7 and arm64 libraries. So I build for both of them using "xcodebuild" and then merge with "lipo -create" command.
    However I think there is a step I'm missing. Please advice. Thank you.
    AIR SDK: 16.0 beta
    Xcode: 6.1.1

    Well the change you need to do is inside your Xcode project, under Build Settings -> Architectures , make sure that you have selected "Standard Architectures (armv7, arm64)". One last thing to ensure that Valid Architectures should also contain arm64 entry along with other armv7 entries.

  • Exception in C++ air native extension for Mac OS X

    I develop air extension for ios and mac os x.
    I use the same code on ios and mac.
    For ios all good.
    But on mac - have problems.
    In extension I use std::vector. Code example:
    vector<Type*>* types; types = new vector<Type*>();  Type* type = new Type(); types->push_back(type);
    Application crashed by line:
    types->push_back(type);
    I tried add try/catch block - but application crashed too.
    I don't know what wrong. This code is work fine on ios and in console application for mac.

    Workaround found:
    Need to launch adl as a line command (depends on your directory config, of course):
    /Applications/Adobe\ Flash\ Builder\ 4.6/sdks/4.6.0/bin/adl -runtime /Library/Frameworks/ -extdir /Users/vandrito/Desktop/simpleAirNativeExtension/launch/extensions -profile extendedDesktop /Users/vandrito/Documents/Projets/o3sui/simpleAirNativeExtensionTest/bin-debug/simpleAirN ativeExtensionTest-app.xml
    Pay attention to the library location: it is the one of the Air 3.1 install. Did not check the same trick with Flash Builder 4.6 Air install.
    Then use a fake web debugger to connect to the process (if compiled in debug mode). See here how to do (french):
    http://www.flex-tutorial.fr/2010/08/05/air-android-debug-sur-mobile-froyo-emulateur-avec-f lash-builder-4/
    Victor

Maybe you are looking for