【发布时间】:2017-02-10 23:38:52
【问题描述】:
如果我从 ParseObject 或 ParseUser 扩展任何对象,它每次都为它包含的每个变量返回 null。例如:
public class User extends ParseUser {
private boolean emailVerified;
private String facebookID;
private int fiveHundredID;
private String fiveHundredUsername;
private String firstName;
private String lastName;
private String canonicalFirstName;
private String canonicalLastName;
private Date birthday;
private Photo profilePicture;
private int followeeCount;
private int followerCount;
}
然后我调用 User.fetchInBackground(),它不填充除 objectId、email 和其他变量之外的任何变量,这些变量仅包含在 ParseUser 类中。当然,我已经在 App 类中初始化 Parse,例如:
Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);
Parse.enableLocalDatastore(getApplicationContext());
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId(Const.X_PARSE_APPLICATION_ID)
.clientKey(Const.X_PARSE_REST_API_KEY)
.server(Const.PARSE_SERVER_URL)
.enableLocalDataStore()
//.addNetworkInterceptor(new JsonInterceptor())
.build());
ParseObject.registerSubclass(User.class);
我没有使用任何 proguard,因为我在 Debug 版本上进行了测试。有什么帮助吗?此外,当我启用 LocalDataStore 时,它会存储我当前的用户。但是当我调用 fetchInBackground() 时,它会返回与存储本地数据相同的数据。此外,当我调用 unpinInBackground() 之后,我将调用 fetchInBackground(),它仍然会返回存储在 DB 中的本地数据。
有什么帮助吗?
非常感谢
【问题讨论】:
-
你添加模型注释了吗?