Local Datastore Queries - Error Code 102

If I query a class with fields / columns that are Pointers to other tables (storing the string of the linked objectId), I get the following error message:

Error Domain=Parse Code=102 “-[PFObject length]: unrecognized selector sent to instance 0x6000037cb8a0” UserInfo={error=-[PFObject length]: unrecognized selector sent to instance 0x6000037cb8a0, NSLocalizedDescription=-[PFObject length]: unrecognized selector sent to instance 0x6000037cb8a0, code=102}

I am using iOS SDK, but I dont believe its a platform-specific issue / error.

I have included these columns as query.includeKeys(), following research found from web searches, which suggests problems with Relations / Pointers with Local Datastore, but the problem remains.

To produce the error, I run the code below:

  1. Comment the query.fromLocalDatastore() call in the code

  2. Run the query which populates the Local Datastore

  3. Stop the app

  4. Remove the comment from the code in step 1, so it now uses the Local Datastore, and comment the pinAll() call instead.

  5. The error message occurs, and the query returned objects is nil

Sample code:

let query = PFQuery(className: "Entry")

query.whereKey("CompID", contains: "someObjectId")
query.includeKey("UserID")
query.includeKey("CompID")
        
query.fromLocalDatastore()
query.findObjectsInBackground { (objects, error) in
     if let error = error {
        print("Get Error: \(error)")
     }
     print("Returned: \(objects?.count)")
     if let objects = objects {
                
        PFObject.pinAll(inBackground: objects, withName: name) { (success, error) in
             if success {
                 print("Pinned all objects")
             }
             if error != nil {
                 print("Pinning error: \(error)")
             }
         }
     }
 }

Any assistance please?

I have tried a second query from another Parse class that only has stored properties, no pointers to other classes. This code behaves as expected.

The problem query also works if I pull it from the Parse server every time. It also works from the REST API and parsing the returned JSON.

What syntax is needed to allow Local Datastore queries with pointers (might be more than 1 pointer too)? Do I need query.includeKeys("FieldName"), as it doesn’t resolve the error either?

I can see what looks like the correct data contained within Entry rows in the ParseOfflineStore SQLite file, such as:

“UserID”:{"__type":“Pointer”,“className”:"_User",“objectId”:“VucIsL2eyU”}