Giter Club home page Giter Club logo

Comments (25)

andrewjedi avatar andrewjedi commented on August 12, 2024 4

I just decided to make another column with an array of strings of the objectId's for now, works great :)

from parselivequery-ios-osx.

byroncoetsee avatar byroncoetsee commented on August 12, 2024 1

So anyone struggling with this, my workaround has been:

extension PFObject {
    func pointer()->[String : Any] {
        guard self.objectId != nil else { return [:] }
        return [
            "__type" : "Pointer",
            "className" : self.parseClassName,
            "objectId" : self.objectId!
        ]
    }
}

Usage:
yourPFObject.pointer()

Can be used in LiveQuery.

from parselivequery-ios-osx.

andrewjedi avatar andrewjedi commented on August 12, 2024

Having the same issue

from parselivequery-ios-osx.

Samigos avatar Samigos commented on August 12, 2024

Same here! I think the above error applies to pointer-comparisons in general...

from parselivequery-ios-osx.

Samigos avatar Samigos commented on August 12, 2024

Good job, but still, the problem remains! Using objectIds isn't always possible.. Sometimes pointers are the only way to go...

from parselivequery-ios-osx.

andrewjedi avatar andrewjedi commented on August 12, 2024

True, we need this fixed ! :(

from parselivequery-ios-osx.

mkaya93 avatar mkaya93 commented on August 12, 2024

I opened this issue 1 month ago and no one from parse team didn't look and gave an answer. How we can fix it ?

from parselivequery-ios-osx.

mmowris avatar mmowris commented on August 12, 2024

Can we get a bump on this? @richardjrossiii @nlutsenko

from parselivequery-ios-osx.

kajensen avatar kajensen commented on August 12, 2024

See #59, i'm sure you can do something nearly identical to allow pfobject pointers.

from parselivequery-ios-osx.

mmowris avatar mmowris commented on August 12, 2024

@kajensen , as in the decode functionality like that PR does for geo?

from parselivequery-ios-osx.

kajensen avatar kajensen commented on August 12, 2024

Yeah just check if its a pfobject and create the dictionary with classname and id. Same thing can be done for nsdates. Not sure what would go into making subqueries and the more complex query parts work.

from parselivequery-ios-osx.

mmowris avatar mmowris commented on August 12, 2024

@kajensen I'll look into that. So I theoretically could watch on the PFUser, but getting any relational data back for instance and working with that would prove to be more challenging?

from parselivequery-ios-osx.

kajensen avatar kajensen commented on August 12, 2024

Yeah, the issue is encoding the non-primitive data types. @richardjrossiii mentioned that the goal was to use the iOS sdk for such things but this is a quick workaround for the time being. I'm not sure of the progress (if any) on that front, i'll defer to the main contributors for that.

Encoding/decoding is the main issue with this library (from what I can tell). If people want to see this library useable (as do I), we're going to need to contribute and not just post "we want this fixed" or "how much longer til this gets fixed". As you can see its not super active nor ready for primetime.

from parselivequery-ios-osx.

AnChiChang avatar AnChiChang commented on August 12, 2024

same issue

from parselivequery-ios-osx.

flovilmart avatar flovilmart commented on August 12, 2024

@kajensen @AnChiChang have you checked at PR's #86 and #87 ? Doe they help?

from parselivequery-ios-osx.

AnChiChang avatar AnChiChang commented on August 12, 2024

I had try this

    let query: PFQuery<Chat>  = Chat.query()!
        .whereKey("products", equalTo: aPFObject)
        .whereKey("togroupbuy", notEqualTo: true) as! PFQuery<Chat>    
    query.findObjectsInBackground {
        (objects, errors) in
        
        print("retrieved object = \(objects)")
        //print(errors)
    }
    
    
    self.subscription = liveQueryClient.subscribe(query).handleSubscribe {
        [weak self]  (_) in
        
        print("Subbed")
        }.handleEvent { [weak self] (_, event) in
            self?.handleEvent(event: event)
    }

or

    let query: PFQuery<Chat>  = Chat.query()!
        .whereKey("products", equalTo: PFObject(withoutDataWithClassName: "Products", objectId: aPFObject.objectId))
        .whereKey("togroupbuy", notEqualTo: true) as! PFQuery<Chat>
        
    query.findObjectsInBackground {
        (objects, errors) in
        
        print("retrieved object = \(objects)")
        //print(errors)
    }

get the same error message
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (PFObject)'

from parselivequery-ios-osx.

AnChiChang avatar AnChiChang commented on August 12, 2024

Sorry, my fault. After update my ParseLiveQuery to 2.0. The problem is solved. Thanks for helping.

from parselivequery-ios-osx.

flovilmart avatar flovilmart commented on August 12, 2024

All good then! Let's close that one!

from parselivequery-ios-osx.

AnChiChang avatar AnChiChang commented on August 12, 2024

hello @flovilmart

I found a issue,
when I use where contained in a array of points. Still get
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (PFObject)'

can help ?

from parselivequery-ios-osx.

flovilmart avatar flovilmart commented on August 12, 2024

Can you provide the logs or debugger dumps from the JSON responses?

from parselivequery-ios-osx.

AnChiChang avatar AnChiChang commented on August 12, 2024

I am not sure which logs actually can help, just paste the dump information from xCode. If you need others, please let me know. Thanks.

        let query: PFQuery<ProductCount>  = ProductCount.query()!
            .whereKey("products", containedIn: findObjects) //findObjects is array of PFObject
            as! PFQuery<ProductCount>
        query.findObjectsInBackground {
            (objects, errors) in
            print("retrieved object = \(objects)")
        }
        
        self.subscription = liveQueryClient.subscribe(query).handleSubscribe {
            [weak self]  (_) in
            
            print("Subbed")
            }.handleEvent { [weak self] (_, event) in
                self?.handleEvent(event: event)
        }

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (PFObject)'
*** First throw call stack:
(
0 CoreFoundation 0x00000001102e3b0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010f933141 objc_exception_throw + 48
2 CoreFoundation 0x000000011034c625 +[NSException raise:format:] + 197
3 Foundation 0x000000010f42d2e2 _writeJSONValue + 679
4 Foundation 0x000000010f42d722 ___writeJSONArray_block_invoke + 130
5 CoreFoundation 0x000000011028ac31 __NSArrayEnumerate + 593
6 Foundation 0x000000010f42d423 _writeJSONArray + 317
7 Foundation 0x000000010f42d253 _writeJSONValue + 536
8 Foundation 0x000000010f481c4b ___writeJSONObject_block_invoke + 223
9 CoreFoundation 0x000000011026c25c __NSDictionaryEnumerate + 572
10 Foundation 0x000000010f481a42 _writeJSONObject + 394
11 Foundation 0x000000010f42d1c3 _writeJSONValue + 392
12 Foundation 0x000000010f481c4b ___writeJSONObject_block_invoke + 223
13 CoreFoundation 0x000000011026c25c __NSDictionaryEnumerate + 572
14 Foundation 0x000000010f481a42 _writeJSONObject + 394
15 Foundation 0x000000010f42d1c3 _writeJSONValue + 392
16 Foundation 0x000000010f481c4b ___writeJSONObject_block_invoke + 223
17 CoreFoundation 0x000000011026c25c __NSDictionaryEnumerate + 572
18 Foundation 0x000000010f481a42 _writeJSONObject + 394
19 Foundation 0x000000010f42d1c3 _writeJSONValue + 392
20 Foundation 0x000000010f481c4b __writeJSONObject_block_invoke + 223
21 CoreFoundation 0x000000011026c25c NSDictionaryEnumerate + 572
22 Foundation 0x000000010f481a42 writeJSONObject + 394
23 Foundation 0x000000010f42d1c3 writeJSONValue + 392
24 Foundation 0x000000010f42cfe7 -[NSJSONWriter dataWithRootObject:options:error:] + 124
25 Foundation 0x000000010f42cecc +[NSJSONSerialization dataWithJSONObject:options:error:] + 337
26 ParseLiveQuery 0x000000010eb738a0 TFFC14ParseLiveQuery6Client18sendOperationAsyncFOS_15ClientOperationGC10BoltsSwift4TaskT__U_FzT_T + 432
27 ParseLiveQuery 0x000000010eb75880 TPA__TFFC14ParseLiveQuery6Client18sendOperationAsyncFOS_15ClientOperationGC10BoltsSwift4TaskT__U_FzT_T + 224
28 ParseLiveQuery 0x000000010eb73d00 TTRXFo__zoPs5Error__XFo__iT_zoPS
+ 32
29 ParseLiveQuery 0x000000010eb75921 TPA__TTRXFo__zoPs5Error__XFo__iT_zoPS
.34 + 81
30 BoltsSwift 0x000000010e64bac7 TZFO10BoltsSwift9TaskState11fromClosurefFzT_xGS0_x + 87
31 BoltsSwift 0x000000010e64d6ed TFFC10BoltsSwift4TaskcFTOS_8Executor7closureFzT_x_GS0_x_U_FT_T + 125
32 BoltsSwift 0x000000010e6447d7 TTRXFo___XFdCb
+ 39
33 libdispatch.dylib 0x00000001146b44a6 _dispatch_call_block_and_release + 12
34 libdispatch.dylib 0x00000001146dd05c _dispatch_client_callout + 8
35 libdispatch.dylib 0x00000001146bb94f _dispatch_queue_serial_drain + 221
36 libdispatch.dylib 0x00000001146bc669 _dispatch_queue_invoke + 1084
37 libdispatch.dylib 0x00000001146bcb32 _dispatch_queue_override_invoke + 654
38 libdispatch.dylib 0x00000001146beec4 _dispatch_root_queue_drain + 634
39 libdispatch.dylib 0x00000001146bebef _dispatch_worker_thread3 + 123
40 libsystem_pthread.dylib 0x0000000114a74616 _pthread_wqthread + 1299
41 libsystem_pthread.dylib 0x0000000114a740f1 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

from parselivequery-ios-osx.

AnChiChang avatar AnChiChang commented on August 12, 2024

I have saw someone can catch the JSON log, how to do that?

from parselivequery-ios-osx.

flovilmart avatar flovilmart commented on August 12, 2024

run parse-server with VERBOSE=1

from parselivequery-ios-osx.

AnChiChang avatar AnChiChang commented on August 12, 2024

verbose: Request: {"sessionToken":"","op":"connect","applicationId":"6gyO0FRa7kb6PjT6b5fum7f09Z2M85St"}
info: Create new client: 6
verbose: Push Response : "{"op":"connected","clientId":6}"

    let obj1 = PFObject(withoutDataWithClassName: "Products", objectId: "gN0cASy1e2")
    let obj2 = PFObject(withoutDataWithClassName: "Products", objectId: "mT7lpqscct")
    
    var objs: [PFObject] = [obj1, obj2]
    
    let remoteQ: PFQuery<ProductCount>  = ProductCount.query()!
        .whereKey("products", containedIn: objs)
        as! PFQuery<ProductCount>
    
    self.subscription = liveQueryClient.subscribe(remoteQ).handleSubscribe {
        [weak self]  (_) in
        
        print("Subbed")
        }.handleEvent { [weak self] (_, event) in
            self?.handleEvent(event: event)
    }

from parselivequery-ios-osx.

AnChiChang avatar AnChiChang commented on August 12, 2024

Below will success subscribe:

verbose: REQUEST for [GET] /parse/classes/ProductCount: {
  "where": {
    "products": {
      "__type": "Pointer",
      "className": "Products",
      "objectId": "gN0cASy1e2"
    }
  }
} method=GET, url=/parse/classes/ProductCount, host=192.168.200.45:1111, x-parse-client-version=i1.14.2, accept=*/*, x-parse-application-id=appid, x-parse-client-key=clientkey, x-parse-installation-id=eda070f3-b50a-4eb8-ac91-cf0e2bec46a0, accept-language=en-us, x-parse-os-version=10.3 (16E195), accept-encoding=gzip, deflate, content-type=application/json; charset=utf-8, content-length=106, user-agent=livequerytest/1 CFNetwork/811.4.18 Darwin/16.5.0, connection=keep-alive, x-parse-app-build-version=1, x-parse-app-display-version=1.0, __type=Pointer, className=Products, objectId=gN0cASy1e2
verbose: RESPONSE from [GET] /parse/classes/ProductCount: {

Below will dump when subscribe:

verbose: REQUEST for [GET] /parse/classes/ProductCount: {
  "where": {
    "products": {
      "$in": [
        {
          "__type": "Pointer",
          "className": "Products",
          "objectId": "gN0cASy1e2"
        },
        {
          "__type": "Pointer",
          "className": "Products",
          "objectId": "mT7lpqscct"
        }
      ]
    }
  }
} method=GET, url=/parse/classes/ProductCount, host=192.168.200.45:1111, x-parse-client-version=i1.14.2, accept=*/*, x-parse-application-id=appid, x-parse-client-key=clientkey, x-parse-installation-id=eda070f3-b50a-4eb8-ac91-cf0e2bec46a0, accept-language=en-us, x-parse-os-version=10.3 (16E195), accept-encoding=gzip, deflate, content-type=application/json; charset=utf-8, content-length=184, user-agent=livequerytest/1 CFNetwork/811.4.18 Darwin/16.5.0, connection=keep-alive, x-parse-app-build-version=1, x-parse-app-display-version=1.0, $in=[__type=Pointer, className=Products, objectId=gN0cASy1e2, __type=Pointer, className=Products, objectId=mT7lpqscct]
verbose: Request: {"sessionToken":"","op":"connect","applicationId":"6gyO0FRa7kb6PjT6b5fum7f09Z2M85St"}
info: Create new client: 0
verbose: Push Response : "{\"op\":\"connected\",\"clientId\":0}"

from parselivequery-ios-osx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.