You must register this ParseObject subclass before instantiating it

前端 未结 2 630
醉酒成梦
醉酒成梦 2021-01-19 14:48

I am getting the following error in my Android application using Parse:

You must register this ParseObject subclass before instantiat

相关标签:
2条回答
  • 2021-01-19 15:22

    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

    0 讨论(0)
  • 2021-01-19 15:32

    You also have to put it in your Manifest like this:

     <application
            android:name="ParseApplication"
            android:allowBackup="true"
            android:icon="@drawable/logo"
            android:label="@string/app_name"         
            android:theme="@style/AppTheme" >
    
    <activity
    YOUR ACTIVITY 1
               />
      <activity
    YOUR ACTIVITY 2
               />
    </application>
    

    And then try swapping these following lines

    Parse.enableLocalDatastore(this);
    Parse.initialize(this, "key", "key");
    

    like this:

     Parse.initialize(this, "key", "key");
     Parse.enableLocalDatastore(this);
    
    0 讨论(0)
提交回复
热议问题