SetReadAccess误差为新的parseObject误差、SetReadAccess、parseObject

2023-09-12 10:34:50 作者:夜眠坂秋.

我有以下的code摆在我的Andr​​oid应用程序我的应用程序类:

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

// 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();
ParseACL defaultACL = new ParseACL();
ParseACL.setDefaultACL(defaultACL, true);

这似乎工作的伟大,只要我有我的应用程序的全新安装和创建新的结果的对象。现在,如果我通过Play商店更新我的应用程序,或者通过Android的工作室安装了它,我得到以下错误,每当新的结果对象,或任何其他的parseObject或其子类,创建了:

This seems to work great whenever I have a fresh install of my app and I create new Results objects. Now, if I update my app via the Play store, or install over it via Android Studio, I get the following error whenever new Results objects, or any other ParseObject or subclass thereof, are created:

java.lang.IllegalArgumentException: cannot setReadAccess for a user with null id

这是使用Parse一个错误?我与脱机藤堂例子相同的结果。

Is this a bug with Parse? I get the same results with the Offline Todo example.

推荐答案

您需要请务必保存当前用户。

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.

 
精彩推荐
图片推荐