实例化之前,你必须先注册此的parseObject小类 [英] You must register this ParseObject subclass before instantiating it
问题描述
我使用得到我的安卓
应用程序下面的错误解析
:
您必须实例化之前注册此的parseObject子类。
在我的应用程序
的对象,我做内部的下列的onCreate
:
Parse.enableLocalDatastore(本);
Parse.initialize(这一点,code,code);
那么,为什么我仍然收到这个错误?这是工作的罚款昨天,但它突然停止工作。
这是我的清单文件:
<应用
机器人:MyApplication的NAME =
机器人:allowBackup =真
机器人:图标=@可绘制/ ic_launcher
....
LogCat中:
java.lang.IllegalArgumentException:如果实例化之前,你必须先注册此的parseObject子类。
在com.parse.ParseObject< INIT>(ParseObject.java:157)
在com.parse.ParseObject< INIT>(ParseObject.java:119)
在usmaan.app.models.Game< INIT>(Game.java:25)
在usmaan.app.models.Game.to(Game.java:86)
在usmaan.app.adapters.GamesAdapter.getView(GamesAdapter.java:47)
在android.widget.AbsListView.obtainView(AbsListView.java:2344)
在android.widget.ListView.makeAndAddView(ListView.java:1864)
您必须调用
ParseObject.registerSubclass(YourClassName.class);
致电前
Parse.initialize()
。
此外,你需要注释你的自定义类是这样的:
@ParseClassName(YourClassName)
公共类YourClassName扩展的parseObject
{
}
最后,您的自定义类需要一个默认的无参数的构造函数,以便通过的parseObject
进行注册。
参考:子类解析对象
I am getting the following error in my Android
application using Parse
:
You must register this ParseObject subclass before instantiating it.
In my Application
object, I am doing the following inside onCreate
:
Parse.enableLocalDatastore(this);
Parse.initialize(this, "code", "code");
So why am I still getting this error? It was working fine yesterday but it's all of a sudden stopped working.
This is my Manifest file:
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
....
LogCat:
java.lang.IllegalArgumentException: You must register this ParseObject subclass before instantiating it.
at com.parse.ParseObject.<init>(ParseObject.java:157)
at com.parse.ParseObject.<init>(ParseObject.java:119)
at usmaan.app.models.Game.<init>(Game.java:25)
at usmaan.app.models.Game.to(Game.java:86)
at usmaan.app.adapters.GamesAdapter.getView(GamesAdapter.java:47)
at android.widget.AbsListView.obtainView(AbsListView.java:2344)
at android.widget.ListView.makeAndAddView(ListView.java:1864)
You must call
ParseObject.registerSubclass(YourClassName.class);
before calling
Parse.initialize()
.
In addition, you need to annotate your custom class like this:
@ParseClassName("YourClassName")
public class YourClassName extends ParseObject
{
}
Finally, your custom class needs a default no-args constructor in order to be registered by ParseObject
.
Reference: Subclassing Parse Object
这篇关于实例化之前,你必须先注册此的parseObject小类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!