Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

PFPointerObjectEncoder error caused app to crash in Release 2.6.1 #215

Closed
bayareahank opened this issue Oct 9, 2019 · 3 comments
Closed

Comments

@bayareahank
Copy link

bayareahank commented Oct 9, 2019

Run into a PFPointerObject encoding error, for pointer to PFObject, in release 2.6.1. It caused the app to crash each time liveQuery starts subscription. This is pretty consistent, and easily reproducible. The error msg is like following:

[PFPointerObjectEncoder encodeObject:]: unrecognized selector sent to instance

It reports error in QueryEncoder.swift, in line dealing with encoding of PFObject Pointer. Line number 49 (for release 2.6.1's version of QueryEncoder.swift).

else if let object = val as? PFObject {
encodedQueryDictionary[key] = (try? PFPointerObjectEncoder.object().encode(object)) as? Value
}

Looks encoding with PFPointer is passed with wrong selector.

This is relatively new, Parse query works fine with PFObject pointer, just liveQuery crashed. I verified that liveQuery with pointer to PFObject works with 2.5.0. Code looks runs fine with 2.6.0 also. I noticed QueryEncoder.swift was changed after 2.6.1 was released, not sure whether that will fix this.

Sample code to trigger this bug, try making a liveQuery with any pointer to PFObject in its predicate.

let message = Message(text: "Hello", source: "you", target: "me")
chatQuery = PFQuery(className: "Message")
.whereKey("target", equalTo: message.pfObject)
// Message being a simple PFObject wrapper, with getter/setter from a PFObject it wraps around.

Replace object with built in types, like String comparison, it will run fine.

@noobs2ninjas
Copy link
Member

Looking at the differences between 2.6 and 2.6.1 here I see that the majority of our changes was bumping parse versions. I am assuming this is where the changes occurred. I actually have a pull request out right now that updates the Parse version again to the latest. I'm still working on getting it out as it also updates our build to Xcode 11. Anyway, when 2.7.0 comes out lets look at this again and see if that fixes it.

Also, you might check and see what version of Parse you are running in your project.

@bayareahank
Copy link
Author

Good pointer.

Yet it looks the bug is triggered even before it talks with the server on live query subscription. I triggered this bug on ParseServer 3.4.4, I tried the latest 3.9.0, it is still there. FYI.

@bayareahank
Copy link
Author

Don't observe this any more. Closing it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants