Backendless custom API aSync callback never gets executed

I have a custom hosted API in Backendless, with several methods.

I’m trying out a method “getMyStatistic” which is supposed to return a GameStatistic custom object.

When using the generated iOS async method to call this API, neither the response or fault callback are never called.
I’ve tried debugging it with CodeRunner, and I can see that the server function is being executed and is correctly returning a GameStatistic object. However, the callback in iOS is never executed.

Using the web API inspector, I can see the results of the call, with correct data in the response body.

So I decided to try the sync method, and it returns an object but it doesn’t cast into a GameStatistic object and when I try to access any of its properties, it crashes:

[__NSDictionaryM timeInSeconds]: unrecognized selector sent to instance 0x7fdf9218bac0

I can see in the debug console that the object is of class __NSDictionaryM, and it has the information I need in several key-value pairs.

What could be going on here? I would need to use the Async method, but I would like to understand why are both errors happening.

Thanks!

Hello jdev,
What language do you use for the CBL?
Could you post an example of the CBL method and the invocation code in your client app. Please use external copy-paste tool like pastebin.com.

Artur

I’m using Java. This would be the CBL method:
http://pastebin.com/PA22ZpPE

And this the iOS invocation, where the callbacks never get called:
http://pastebin.com/jjYtbtHk

Right now in debug mode (with CodeRunner) has worked and I can see the callback being called. Why was it happening?

However, the returned object instead of a GameStatistic object is a __NSDictionaryM…

I thought that the SDK would parse the response into my custom object. Do I need to do anything to make that happen?

Thanks!

Please post here the object you receive from code runner

Looks like you need PersisitenceService mapTableToClass: method.
You could investigate this sample of our BlogFeatureDay project.

Ok, problem solved!

In the AppDelegate I was doing:

[backendless.data mapTableToClass:@"GameStatistic" type:GameStatistic.class];

But this was returning this object:

"___class" = "net.mydomain.myapp.models.GameStatistic";
    gameType = Memory;
    hitPercentage = 100;
    timeInSeconds = "14.60075002908707";
    verbTense = Presente;

And by looking at the class referenced, I changed the method call to:

[backendless.data mapTableToClass:@"net.mydomain.myapp.models.GameStatistic" type:GameStatistic.class];

And now it is working!

Thanks

I’m having the same issue right now. I’m calling the same method and the callback isn’t being executed…

I think this was happening because I was calling the async method from a background thread. I’ve changed it to execute from main thread, and it works again.