Hi,
today I was trying to port my services from Backendless 3 to Backendless 4. Unfortunately I cannot make them works when called by the iOS app.
When I try to call them through the debug console all work fine.
Here are the two services basic implementation in the Java code deployed into the BE:
public String sayHello(String name) {
return "Hello " + name;
}
and the second one:
public boolean addDiscoteca(Discoteca discoteca) {
Discoteca discotecaFromDB = getDiscotecaWithFacebookId(discoteca.getFacebookId());
if (discotecaFromDB == null) {
Backendless.Persistence.of(Discoteca.class).save(discoteca);
}
return discotecaFromDB == null;
}
And here’s how I invoke these services in my app:
let name: String = "Matteo"
backendless?.customService.invoke("DiscotecaServices", serviceVersion: "0.0.0__debug", method: "sayHello", args: [name], response: { result in
completion?(nil)
}, error: { fault in
completion?(fault)
})
let discoteca = Discoteca()
discoteca.name = "Fabric"
backendless?.customService.invoke("DiscotecaServices", serviceVersion: "0.0.0__debug", method: "addDiscoteca", args: [discoteca], response: { result in
completion?(nil)
}, error: { fault in
completion?(fault)
})
For the sayHello service I received this error message:
\'Server.Processing\' [java.lang.ClassCastException@6afe0992] <java.lang.ClassCastException@6afe0992> )
For the addDiscoteca service I received this one:
\'Server.Processing\' [java.lang.ClassCastException@5070840b] <java.lang.ClassCastException@5070840b>
For both the services CodeRunner doesn’t starts because these exceptions are raised before the Java methods take place.
Where am I wrong?