"Error: this object is not available in the offline cache" occurs only a few times using the Parse backend

i currently added a parsing component for my ios project and defined it to work with a local data warehouse. all this seems to work fine, except that sometimes I get “This object is not available in the offline cache”, everything is tough, as I understand it, when using local data storage there is no cache (including this in my AppDelegate as follows: Parse enableLocalDatastore];). the problem is that if I open the application again, over time this object will be successfully restored. Has anyone encountered this problem before?

EDIT: the order of the calls I make

PFQuery *query = [PFQuery queryWithClassName:className]; [query fromLocalDatastore]; [query whereKey:someKey equalTo:someObject]; [query includeKey:@"someKey1"]; [query includeKey:@"someKey2"]; [query orderByAscending:@"date"]; [query findObjectsInBackground]; 

its built for ios sdk 8.0 and parse sdk 1.7.2

thanks!

+6
source share
3 answers

You need to create a strong link to this inaccessible object before binding another object to the local data store. Without a strong link, the object will be unloaded from the offline cache, although the current and other object that you pinned will be saved. Therefore, when you re-request, you get the error message above.

+1
source

I had the same problem. My reason was that I linked the same request objects with the same name in two places in my code. When I remove a pin with a name function and just write it. Everyone works great for me.

+1
source

Make sure you also attach any objects that may be associated with the request by calling

 [query includeKey:@"someKey1"]; 

for all pointers to all objects that may be required.

0
source

Source: https://habr.com/ru/post/988657/


All Articles