简体   繁体   中英

Parse.com Android SDK: estimatedData and serverData on ParseObject differ immediately after download

On my Parse.com project, I have _User objects with some associated objects (UserData, Team, etc.). The UserData object then has fields, one of which is groupIds. When I pull the UserData object (sometimes) the groupIds field returns an empty list. I put a breakpoint right after the object is downloaded (nothing has been done with the object) and inspected the serverData and estimatedData. After some investigation i found that serverData is a HashMap containing all the key, value pairs associated with the ParseObject. The HashHap is stored in an inner class called State. The estimatedData is the same thing but it is a field in the ParseObject itself. From what I have gathered, estimatedData is a local copy that can be compared to serverData to calculate things like ParseObject#isDirty (if the object has been modified but not changed).

So with all that information my problem is all the more perplexing: Sometimes, immediately after download, the groupIds value is an empty array but the serverData value for groupIds contains the correct List. Calling userData.fetch() and userData.fetchIfNeeded() doesn't remedy the problem. I don't understand how its possible for these to be different right after download or right after fetch. This only happens on this specific ParseObject on this specific field. It also only happens on Android (this application also runs on iOS and I don't have this issue). If anyone know a solution on workaround (ie accessing serverData directly) any help would be greatly appreciated. I also combed trough the Parse Android SDK source code for ParseObject and couldn't find any issue but I may have missed something. Thanks!

For the record, this was an issue where I was passing a reference to the object and then filtering its values without making a copy. This meant when I tried to filter I was actually removing data from the object when in my head I was working with a copy. This was just me being a very inexperienced developer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM