When I started working with parse live query I knew from the beginning it would be a challenge. Seeing that there were muiple ways to create a live query. When I had the set up the server early on, the bit of code I used to listen for updates looked like this:
let liveQueryClientMessage = ParseLiveQuery.Client()
qMessages.whereKey("toUser", equalTo: (PFUser.current()?.objectId!)! as String)
messageSubscription = liveQueryClientMessage.subscribe(qMessage).handle(Event.created){ _, message in
//prepare a local notification alert
print("object updated")
}
This however, no longer seems to function properly. So I looked at the parse live query docs to see if there was a working example and found that this gets the server to "Create new client: " with this code:
let qMessages = PFQuery(className: "Messages")
qMessages.whereKey("toUser", equalTo: (PFUser.current()?.objectId!)! as String)
let subscription = Client.shared.subscribe(qMessages)
subscription.handle(Event.updated){ query, event in
print("object updated")
}
But I am unable to get the print message to display... Am I missing something? I'm using the latest version of parselivequery I believe:
pod 'ParseLiveQuery'
UPDATE1: So I tried to rebuild the server and the issue still seems to persist. I'll try and make use of a parse query and see if its the filter... UPDATE2: I rolled back the version of the podfile just in case it was an issue with just grabbing the lastest master branch. No fix yet...
The solution to fixing this issue was related to where everything was defined. Refer to the awnser to this stackoverflow question: Parse Cloud - LiveQueries - iOS Client doesn't work There's sufficient explanation there too.