Native IOS callback.

17 views
Skip to first unread message

durg...@gmail.com

unread,
Oct 14, 2016, 12:45:10 AM10/14/16
to CodenameOne Discussions
If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA
Desktop OS
Simulator
Device


I am trying to do a native IOS callback for estimote monitoring project.
In codename one(Netbeans) i had implemented the call back methods as,

 public void initialise(ActionListener callback) {
            initCallback = callback;    
            estimoteSDK.initialise();
          
    }
    
    public void serviceReady() {
        if (initCallback != null) {
        initCallback.actionPerformed(new ActionEvent(instance));
        }
    }
    
    public static void ready() {
        getInstance().serviceReady();
        
    }
when i build and run it in the VM the method body for serviceReady() and ready() methods are not getting generated. Please find below the generated code.
(XCODE version:7.3), 

JAVA_VOID com_littlemonkey_estimote_BeaconManager_initialise___com_codename1_ui_events_ActionListener(CODENAME_ONE_THREAD_STATE, JAVA_OBJECT  __cn1ThisObject, JAVA_OBJECT __cn1Arg1) {
    DEFINE_INSTANCE_METHOD_STACK(2, 2, 0, 6197, 6198);
    locals[0].data.o = __cn1ThisObject; locals[0].type = CN1_TYPE_OBJECT;     locals[1].data.o = __cn1Arg1;
    locals[1].type = CN1_TYPE_OBJECT;
    __CN1_DEBUG_INFO(51);
    set_field_com_littlemonkey_estimote_BeaconManager_initCallback(threadStateData, __cn1Arg1, __cn1ThisObject);
    __CN1_DEBUG_INFO(52);
    PUSH_POINTER(get_field_com_littlemonkey_estimote_BeaconManager_estimoteSDK(__cn1ThisObject));
    virtual_com_littlemonkey_estimote_EstimoteSdk_initialise__(threadStateData, SP[-1].data.o);     SP -= 1;
    __CN1_DEBUG_INFO(54);
    releaseForReturn(threadStateData, cn1LocalsBeginInThread);
    return;
}


JAVA_VOID com_littlemonkey_estimote_BeaconManager_serviceReady__(CODENAME_ONE_THREAD_STATE, JAVA_OBJECT  __cn1ThisObject) {
    return;
}


JAVA_VOID com_littlemonkey_estimote_BeaconManager_ready__(CODENAME_ONE_THREAD_STATE) {
    return;
}

only the methods serviceReady() and ready() are not getting generated.



 

Shai Almog

unread,
Oct 14, 2016, 10:31:17 PM10/14/16
to CodenameOne Discussions, durg...@gmail.com
Our optimizer removes unused calls and must have missed the calls from native code. As a workaround do something like this in a reachable part of your code:

if(false) {
   obj
.serviceReady();
   obj
.ready();
}

It should work regardless so I'm not sure what happened there, if you can extract a test case that reproduces this please file an issue.
Reply all
Reply to author
Forward
0 new messages