SCMessage
.sendPush(query, subject, text, callback)
Push sending method
Parameter | Type | Properties | Description | Value example |
---|---|---|---|---|
query | SCQuery |
Users/Devices collection query for sampling addressees | ||
text | String |
Push text | "Push text" | |
callback | (Bool, SCError?, Int?) -> Void |
Callback for the request being executed. |
Example
var queryUserDevices = SCQuery(collection: "devices")
var broadcast = SCMessage()
queryUserDevices.exists("userRelation")
broadcast.sendPush(queryUserDevices, text:"Push text") {
success, error, result in
if success {
print("Success")
} else {
if let error = error {
print("Error")
}
}
}
var queryUserDevices = SCQuery(collection: "devices")
var broadcast = SCMessage()
queryUserDevices.exists("userRelation")
broadcast.sendPush(queryUserDevices, text:"Push text") {
success, error, result in
if success {
print("Success")
} else {
if let error = error {
print("Error")
}
}
}
.sendSms(query, subject, text, callback)
SMS sending method
Parameter | Type | Properties | Description | Value example |
---|---|---|---|---|
query | SCQuery |
Users collection query for sampling addressees | ||
text | String |
SMS text | "SMS text" | |
callback | (Bool, SCError?, Int?) -> Void |
Callback for the request being executed. |
Example
var queryUsersWithPhone = SCQuery(collection: "users")
var broadcast = SCMessage()
queryUsersWithPhone.exists("phone")
broadcast.sendSms(queryUsersWithPhone, text:"SMS text") {
success, error, result in
if success {
print("Success")
} else {
if let error = error {
print("Error")
}
}
}