App crash when I submit a new post to Parse

前端 未结 5 548
逝去的感伤
逝去的感伤 2021-01-20 03:13

This is the only Place my app crashes and one of the more important features

The LogCat tells me:

java.lang.IllegalArgumentException: You must

相关标签:
5条回答
  • 2021-01-20 03:17

    In my case I had to remove the '@ParseClassName' annotation in my model class. My understanding is that if I have a parse model class 'Posts' and I call 'registerSubclass(yourclassname)' in Application, then all I need is

    Post obj = new Post();
    
    0 讨论(0)
  • 2021-01-20 03:19

    I got this error because I forgot to register my parse class as a subclass in my application extension:

    public class App extends Application
    {
        @Override
        public void onCreate()
        {
            super.onCreate();
    
            App application = this;
    
            ParseObject.registerSubclass(Posts.class); // <-- This is what you need
    
            Parse.enableLocalDatastore(this);
            Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
                                     .applicationId(EnvironmentConfig.appID)
                                     .server(EnvironmentConfig.serverName)
                                     .enableLocalDataStore()
                                     .build());
    
            ParseInstallation.getCurrentInstallation().saveInBackground();
        }
    }
    
    0 讨论(0)
  • 2021-01-20 03:24

    Replace this line

    ParseObject post = new ParseObject("Posts");
    

    with this

    ParseObject post = ParseObject.create("Posts");
    
    0 讨论(0)
  • 2021-01-20 03:36

    You probably made a mistake in initialising Parse in your Application class. Or forgot to put android:name=".YourApplicationClass" in your Manifest file.

    0 讨论(0)
  • 2021-01-20 03:37

    Ensure that you've added the below line in the Application.java class where Parse is initialised

    ParseObject.registerSubclass(Message.class);
    
    0 讨论(0)
提交回复
热议问题