PFQuery cache and local datastore question

Im doing some updating to the iOS documentation and I noticed the PFQuery fromLocalDataStore() function. Is setting the cachePolicy to .cacheOnly not the same thing? Can objects in the datastore not show up in cache or is it the other way around where cached results not necessarily be in the local datastore. Does cache work without Parse having local datastore enabled?

Hey @noobs2ninjas! Great to see you are investigating and updating the documentation! Thank you for that effort.

The fromLocalDataStore() and setting the cachePolicy to kPFCachePolicyCacheOnly might work similarly on some situations but not all of them.

When using the fromLocalDataStore() method you specify that data must be retrieved from the local data storage only. This might seem super simple at first but can get tricky depending on a few details. For instance, if you you make a query looking for results on Local Data Store and find no matches, an empty array will be returned.

On the other hand, if you specify kPFCachePolicyCacheOnly and have no cached results on the device, you will get a NSError.
Also, this will only look into cached results, which Parse can delete at any time when taking too much space.

Hope this helps you…
Best regards!

Thanks for the reply this helps a lot!