2017-02-10 64 views
0

如果我延長從的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,電子郵件和其他變量,包含僅在ParseUser類的任何變量。當然,我已經在App類像初始化解析:

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(),它仍然會返回存儲在數據庫中的本地數據。

任何幫助?

非常感謝

+0

你添加註釋的模型? –

回答

0

添加該註釋略高於模型類:

@ParseClassName("User") 
public class User extends ParseUser { 
    ... 
+0

@Abdenaceur_Lichiheb好吧,我不能添加ParseClassName,因爲它會拋出錯誤:** com.parse.ParseUser無法轉換爲 .Parse.User ** – user997777

+0

@ user997777那麼您無法添加註冊對象註釋,因爲該類不會被識別,你可以粘貼你的錯誤。 –

+0

@Abdenaceur_Lichiheb我已經檢查過,返回給我的是什麼,它給了我來自服務器的正確數據。這只是一個問題,它看起來不會更新本地數據存儲中的數據,並將數據存儲中的舊數據返回給我。你知道這個問題嗎? – user997777