新的parseObject(QUOT;消息")应用程序崩溃 [英] new ParseObject("Message") crashes app

查看:268
本文介绍了新的parseObject(QUOT;消息")应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建一个新的parseObject像这样:

I'm attempting to create a new ParseObject like so:

ParseObject message = new ParseObject("Message");

当我运行应用程序,它给了我以下错误:

When I run the app, it gives me the following error:

java.lang.IllegalArgumentException: You must create this type of ParseObject using ParseObject.create() or the proper subclass.

这是我的全code

ParseObject message = new ParseObject("Message");
message.put("content", "words go here");
message.saveInBackground();

更多code如果需要,可以公布。所有的帮助是AP preciated!

More code can be posted if needed. All help is appreciated!

推荐答案

从这个例子: https://开头parse.com/docs/android_guide#objects

您可以创建像这样的对象:

You can create objects like so:

ParseObject gameScore = new ParseObject("GameScore");
gameScore.put("score", 1337);
gameScore.put("playerName", "Sean Plott");
gameScore.put("cheatMode", false);
gameScore.saveInBackground();

在我的应用程序现在其实类似code ++工程。

In fact similar code works in my app right now.

如果您已经创建了一个扩展的parseObject您可能需要调用新的Message()在这个问题看作一个消息模型:

If you have created a Message model that extends ParseObject you may want to call new Message() as seen in this question:

https://www.parse.com/questions/new- parseobjectchat-压碎的非应用

这答案建议使用.create()可以解决这个问题,但并没有解释为什么。

This answer suggests using .create() may fix the problem but doesn't explain why.

应用程序崩溃时,我提出一个新的岗位解析

另外,还要确保你正确初始化用正确的钥匙您的应用,您使用的是最新版本的SDK。

Also make sure you are properly initializing your app with the correct keys and you are using the latest version of the SDK.

这篇关于新的parseObject(QUOT;消息")应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆