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

LiveQuery doesn't work with Dates #113

@rafaelmaroxa

Description

@rafaelmaroxa

I have a query that looks like this:

NSDate *timeFilter = [NSDate dateWithTimeIntervalSinceNow:-(kMatchesNearMeTimeFilter)];

PFQuery *query = [PFQuery queryWithClassName:@"Match"];
[query whereKey:@"status" containedIn:@[kMatchStatusOpen, kMatchStatusInProgress]];
[query whereKey:@"location" nearGeoPoint:geopoint withinMiles:kMatchesNearMeDistance];
[query whereKey:@"updatedAt" greaterThanOrEqualTo:timeFilter];
[query includeKey:@"organizer"];
[query orderByDescending:@"updatedAt"];

When I try to subscribe to this query, the app crashes with an error very similar to the picture below (as seen on #97).

image

When Client serializes the ClientOperation to write it to the socket, JSONSerialization blows up because the Dictionary extension in QueryEncoder.swift fails to preemptively serialize any Dates that might be part of the query before it goes to JSONSerialization. I created a little playground that isolates the problem, and here's the error:

image

Possibly related issues: #16, #43, and #97.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions