如何正确地将ParseObject发送到云功能?

时间:2015-08-11 09:58:53

标签: android parse-platform

当我尝试将ParseObject发送到云功能时

params.put("obj", myParseObject);
ParseCloud.callFunctionInBackground(functionName, params,...

我收到错误IllegalArgumentException("ParseObjects not allowed here"

将ParseObject发送到clould funciton的正确方法是什么?

3 个答案:

答案 0 :(得分:0)

您无法将ParseObjects发送到云代码。您应该发送对象Id字符串,然后在云代码上获取对象。

答案 1 :(得分:0)

Cloud Functions 期望参数为 JSON 对象,就像在普通的 JS 后端一样。

In an App as in flutter I do Map<String, dynamic> and it automatically converts through the library to a JSON object.

I also have to convert the parseObject on my store into a JSON object to generate a map ( this is just necessary in flutter )

final parseObjectMap = Map<String, dynamic>.from(boardObject.toJson());
      saveWetSuitFunction
          .execute(parameters: myMap)

答案 2 :(得分:-1)

很抱歉这有点晚了,但您可以尝试obj.saveInBackground()

这将此对象保存在后台线程中的服务器上。这比使用ParseObject.save()更可取,除非您的代码已经从后台线程运行。

你可以在这里找到一个参考: http://parse.com/docs/android/api/com/parse/ParseObject.html#saveInBackground%28%29