Search code examples
iosswiftparse-platformpush-notificationpush

Why Parse push.setQuery not working on Swift?


I'm trying to send a notification to the owner of a post when another user taps the "favorite" button, but I'm receiving an error:

Can't set both the query and channel (s) properties.

What can it be? My current code:

let query = PFInstallation.query()
if let query = query {
    query.whereKey("installationUser", equalTo: self.job!["owner"]! as! String)
    let push = PFPush()
    push.setChannel("Global")
    push.setMessage("Some cool text here")
    push.setQuery(query)
    push.sendPushInBackground()
}

The app crashes whenever I execute the line push.setQuery(query)


Solution

  • Remove the line push.setChannel("Global")