SetReadAccess error for new ParseObject

后端 未结 2 1937
抹茶落季
抹茶落季 2020-12-07 04:10

I have the following code placed in my application class of an Android app of mine:

// Register ParseObject subclasses
ParseObject.registerSubclass(Results.c         


        
相关标签:
2条回答
  • 2020-12-07 04:29

    delete the app from device, and install again. it should work.

    here is my setup

        //Parser App Crash Report
        ParseCrashReporting.enable(this); //THIS is to test only =>  throw new RuntimeException("Test Exception!");
    
        // Enable Local Datastore.
        Parse.enableLocalDatastore(this);
    
        // Initialise
        Parse.initialize(this, PARSE_APP_ID, PARSE_CLIENT_KEY);
    
    
        ParseUser.enableAutomaticUser();
        ParseUser.getCurrentUser().saveInBackground();
        ParseACL defaultACL = new ParseACL();
    
        // If you would like all objects to be private by default, remove this line.
        defaultACL.setPublicReadAccess(true);
    
        ParseACL.setDefaultACL(defaultACL, true);
    

    then test with :

    ParseObject testObject = new ParseObject("TestObject");
    testObject.put("foo", "bar");
    testObject.put("2", "2");
    testObject.put("3", "3");
    testObject.saveInBackground();
    
    0 讨论(0)
  • 2020-12-07 04:46

    You need to make sure to save the current user.

    // Register ParseObject subclasses
    ParseObject.registerSubclass(Results.class);
    
    // Set up Parse
    Parse.enableLocalDatastore(MyApplication.this);
    Parse.initialize(MyApplication.this, PARSE_APP_KEY, PARSE_CLIENT_KEY);
    ParseUser.enableAutomaticUser();
    ParseUser.getCurrentUser().saveInBackground(); // <--- This Line
    ParseACL defaultACL = new ParseACL();
    ParseACL.setDefaultACL(defaultACL, true);
    

    Not entirely sure about my syntax, I've only done it in Swift.

    0 讨论(0)
提交回复
热议问题