我正在尝试使用服务器“推送器”发送可行的通知。我希望能够从我的iPad应用程序发送远程通知,并在我的iPhone应用程序上获取它。我已经集成了客户端sdk,消息可以很好地传递到iPhone。但是,这不是我希望的可行通知。
这是从iPad发送消息的代码-
func test () {
let instanceId = "MY_ID"
let secretKey = "MY_KEY"
let pushNotifications = PushNotifications(instanceId: instanceId, secretKey: secretKey)
let interests = ["hello"]
let content = UNMutableNotificationContent()
let publishRequest = [
"apns": [
"aps": [
"alert":"WOW",
"body":"COOL",
"category" : "NEWS_CATEGORY"
]
]
]
// Call the publish method.
try? pushNotifications.publish(interests, publishRequest) { publishId in
print(publishId)
}