Ios 接收来自Sinch的推送通知,Swift 3
我有以下问题:我收到推送通知,但推送通知的标题和正文没有显示。推送通知仅显示我在localizable.string中定义的内容,而不是我在代码中定义的内容。我的应用程序代理中有以下代码:Ios 接收来自Sinch的推送通知,Swift 3,ios,swift,push-notification,sinch,Ios,Swift,Push Notification,Sinch,我有以下问题:我收到推送通知,但推送通知的标题和正文没有显示。推送通知仅显示我在localizable.string中定义的内容,而不是我在代码中定义的内容。我的应用程序代理中有以下代码: // SINManagedPushDelegate - FORWARD INCOMING PUSH NOTIFICATIONS TO A SINCH CLIENT func managedPush(_ unused: SINManagedPush, didReceiveIncomingPushWi
// SINManagedPushDelegate - FORWARD INCOMING PUSH NOTIFICATIONS TO A SINCH CLIENT
func managedPush(_ unused: SINManagedPush, didReceiveIncomingPushWithPayload payload: [AnyHashable: Any], forType pushType: String) {
}
//Describes what happens with handleRemoteNotfication from above
func handleRemoteNotification(_ userInfo: [AnyHashable: Any]) {
let result: SINNotificationResult = (self.client?.relayRemotePushNotification(userInfo))!
if !(self.client != nil) {
let userId: String? = UserDefaults.standard.object(forKey: "userId") as! String?
if userId != nil {
self.initSinchClientWithUserId(userId: userId!)
}
}
if result.isCall() && result.call().isTimedOut {
if #available(iOS 10.0, *) {
let content = UNMutableNotificationContent()
content.categoryIdentifier = "awesomeNotification"
content.title = "Missed Call"
content.body = String(format: "Missed Call from %@", arguments: [result.call().remoteUserId])
content.sound = UNNotificationSound.default()
}
else {
let alert: UIAlertController = UIAlertController(title: "Missed Call", message: String(format: "Missed Call from %@", arguments: [result.call().remoteUserId]), preferredStyle: .alert)
let okAction = UIAlertAction(title: "Ok", style: .default, handler: {_ -> Void in
alert.dismiss(animated: true, completion: nil)
} )
alert.addAction(okAction)
self.window?.rootViewController?.present(alert, animated: true, completion: nil)
}
}
self.client?.relayRemotePushNotification(userInfo)
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
// func application(_ application: UIApplication, didReceiveRemoteNotification data: [AnyHashable : Any]) {
print("Push notification received: \(userInfo)")
print("Remote Notification")
self.sinchPush.application(application, didReceiveRemoteNotification: userInfo)
}
// implementation of SINCallClientDelegate - PRESENTING LOCAL NOTIFICATIONS FOR INCOMING CALLS
private func client(_ client: SINClient, localNotificationForIncomingCall call: SINCall) -> SINLocalNotification {
let notification = SINLocalNotification()
notification.alertAction = "Answer"
notification.alertBody = "Incoming call from \(call.remoteUserId)"
return notification
}
如果呼叫超时,我会收到通知,这也不起作用
谁能帮忙?非常感谢在VoiP推送中,您只能定义您希望看到的内容,所以这就是为什么您要看到您看到的内容 在推送VoiP推送中,您只能定义您希望看到的内容,因此您可以看到您看到的内容 在我的例子中,它说
在作用域中找不到类型“SINLocalNotification”
你能告诉我如何删除此错误吗?在我的例子中,它说在作用域中找不到类型“SINLocalNotification”
你能告诉我如何删除此错误吗?