我正在尝试创建一个新的 ParseObject,如下所示:
ParseObject message = new ParseObject("Message");
当我运行该应用程序时,出现以下错误:
java.lang.IllegalArgumentException: You must create this type of ParseObject using ParseObject.create() or the proper subclass.
这是我的完整代码
ParseObject message = new ParseObject("Message");
message.put("content", "words go here");
message.saveInBackground();
如果需要,可以发布更多代码。感谢所有帮助!
从这个例子来看:https://parse.com/docs/android_guide#objects https://parse.com/docs/android_guide#objects
您可以像这样创建对象:
ParseObject gameScore = new ParseObject("GameScore");
gameScore.put("score", 1337);
gameScore.put("playerName", "Sean Plott");
gameScore.put("cheatMode", false);
gameScore.saveInBackground();
事实上,类似的代码现在可以在我的应用程序中运行。
如果您创建了一个扩展 ParseObject 的 Message 模型,您可能需要调用 new Message() ,如本问题所示:
https://www.parse.com/questions/new-parseobjectchat-crushes-the-app https://www.parse.com/questions/new-parseobjectchat-crushes-the-app
这个答案表明使用 .create() 可以解决问题,但没有解释原因。
当我向 Parse 提交新帖子时应用程序崩溃 https://stackoverflow.com/questions/27727679/app-crash-when-i-submit-a-new-post-to-parse
另请确保您使用正确的密钥正确初始化您的应用程序,并且您使用的是最新版本的 SDK。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)