Exception when updating 1:N relationship - Backend crash

I am unable to update my objects properly

My class has two 1:N relationships to BackendlessUser

I’m trying to update an existing object like this:

self.members = newMembers

self.invitedMembers = newInvitedMembers

BEL.persistenceService.save(self, response: { (obj) -> Void in

I’m then getting the exception listed at the bottom of the post.

If I try to create a new object like this, there’s no problems. The data that I’m putting in the properties “member” and “invitedUser” are EXACTLY the same:
let newobj = MyClass()
newobj.name = “asdf”

    newobj.members = newMembers
    newobj.invitedMembers = newInvitedMembers
    







    BEL.persistenceService.save(newobj, response: { (obj) -> Void in

If I’m not resetting the arrays, I can save without problems in both cases. The relations are setup correctly on backend.

Am I missing something or is this a bug? I’m trying to migrate from Parse.com. It went smooth until this…

‘Server.Processing’ [java.lang.ClassCastException: java.util.HashMap cannot be cast to weborb.v3types.V3Message] <java.lang.ClassCastException: java.util.HashMap cannot be cast to weborb.v3types.V3Message
at weborb.dispatch.V3Dispatcher.dispatch(V3Dispatcher.java:41)
at controllers.WebORB.handleAMFRequest(WebORB.java:90)
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$87$$anonfun$apply$87.apply(routes_routing.scala:4262)
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$87$$anonfun$apply$87.apply(routes_routing.scala:4262)
at play.core.Router$HandlerInvokerFactory$$anon$4.resultCall(Router.scala:264)
at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.invocation(Router.scala:255)
at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:55)
at com.backendless.TimeOutAction.call(TimeOutAction.java:57)
at com.backendless.CloseEntityManagerAction.call(CloseEntityManagerAction.java:18)
at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82)
at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:40)
at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:46)
at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:32)
at scala.concurrent.impl.Future$.apply(Future.scala:31)
at scala.concurrent.Future$.apply(Future.scala:492)
at play.core.j.JavaAction$class.apply(JavaAction.scala:82)
at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.apply(Router.scala:252)
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130)
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:129)
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:128)
at scala.Option.map(Option.scala:146)
at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:128)
at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:121)
at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483)
at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483)
at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519)
at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519)
at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496)
at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)

at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

Hi Jonas,

If I’m not mistaken, you’re using Swift SDK?
Could you please prepare some minimal sample application, which reproduces the problem? It would greatly speed up our work on the fix.

Hi Jonas,

What is the class of the newMembers and newInvitedMembers objects? Sounds like it would be a collection. If it is, what is the class of the objects within the collection?

Regards,
Mark

Here’s a project that reproduces the error. You’ll need to delete the users that are created between each run.

The lib’s are not attached. The size of the zip got too big then.

Also I could not attach the file here for some reason. Try this link:
http://s000.tinyupload.com/?file_id=54621831536746022593

Thanks for help! We’ll look into it ASAP.

The file:

smackit 2.zip (50.77kB)

Hi Jonas,

I have forwarded the project to our iOS expert. We will investigate the problem and respond back asap.

Regards,
Mark

Found 2 more bugs with almost the same scope, but different error messages.

smackit 3-file gives me a plain ClassCastException without stacktrace

smackit 4-file gives me an fault like this:
FAULT = ‘2002’ [Version is disabled or provided wrong application info (application id or secret key)] <Version is disabled or provided wrong application info (application id or secret key)>

This is not looking good. Am I doing something wrong? Is this just bugs on your end?

These files have my appid and secret key with them. I forgot to remove them.

smackit 4 - wrongappinfo.zip (51.9kB)

Make sure you are using the right secret key in the initapp call. If you pick REST key for an ios app, you will get that message.

I’m using the correct key. If I make changes in my code, that error disappear. The error message from your part is apparently wrong since it’s working with simple requests.

Jonas,

our developer is looking into it.

Regards,
Mark

Hi Jonas,

This issue has been fixed, you can get the fixed lib from the github: https://github.com/Backendless/ios-SDK/tree/master/SDK/lib/backendless , and try it with your app again.

Regards,
Slava

Hi Jonas,

We’ve made some additional correction, so you can download the fixed libs from the github:
https://github.com/Backendless/ios-SDK/tree/master/SDK/lib/CommLibiOS
https://github.com/Backendless/ios-SDK/tree/master/SDK/lib/backendless

Regards,
Slava