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

Compound live queries not supported #47

Closed
AmbroiseCollon opened this issue Jul 9, 2016 · 3 comments
Closed

Compound live queries not supported #47

AmbroiseCollon opened this issue Jul 9, 2016 · 3 comments

Comments

@AmbroiseCollon
Copy link

AmbroiseCollon commented Jul 9, 2016

Versions

Parse iOS SDKs (1.13.0)
ParseLiveQuery iOS SDKs (1.0.1)
Parse Server (2.2.15)

Description

When trying to pass a compound queries to live server, the app crashes saying : Invalid type in JSON write (PFQuery).

The crash occurs at this line in ClientPrivate.swift :

internal func sendOperationAsync(operation: ClientOperation) -> Task<Void> {
    return Task(.Queue(queue)) {
        let jsonEncoded = operation.JSONObjectRepresentation
THIS LINE => let jsonData = try NSJSONSerialization.dataWithJSONObject(jsonEncoded, options: NSJSONWritingOptions(rawValue: 0))
        let jsonString = String(data: jsonData, encoding: NSUTF8StringEncoding)

        self.socket?.send(jsonString)
    }
}

The jsonEncoded details :

▿ 3 elements
  ▿ [0] : 2 elements
    - .0 : "requestId"
  ▿ [1] : 2 elements
    - .0 : "op"
    - .1 : subscribe
  ▿ [2] : 2 elements
    - .0 : "query"
    ▿ .1 : 2 elements
      ▿ [0] : 2 elements
        - .0 : className
        - .1 : Game
      ▿ [1] : 2 elements
        - .0 : where
        ▿ .1 : 1 elements
          ▿ [0] : 2 elements
            - .0 : $or
            ▿ .1 : 2 elements
              - [0] : <PFQuery: 0x7fb71bcf99d0> <= ISSUE
              - [1] : <PFQuery: 0x7fb71be38020> <= ISSUE

Support for compound queries (along with pointers, cf #16) would be great !

@AmbroiseCollon
Copy link
Author

AmbroiseCollon commented Jul 9, 2016

Quick fix in the meantime: Create as many client as queries you want to compound. Not ideal but ok if like in my case you have only 2 queries to compound.

PS : I couldn't manage to have two queries per subscription or two subscription per client.

@AmbroiseCollon
Copy link
Author

Any update or timeline on this ? Thanks

@AmbroiseCollon
Copy link
Author

Still no update ?

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