[英]Turn on/off vibration and sound while receiving remote notification ios swift
我有设置我的应用程序,因为我有开启和关闭的声音和振动 ,以及一个切换按钮,同时接收远程通知。 以下是我在AppDelegate
注册远程通知的代码
let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Sound]
let pushNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
application.registerUserNotificationSettings(pushNotificationSettings)
application.registerForRemoteNotifications()
对于声音,我提到了“ 从通知中删除声音”,但似乎不起作用。
Whatsapp具有此功能,因此肯定会
有人可以在这方面提出建议吗?
请从JSON有效负载中删除声音键值。
我刚刚检查过。 这个对我有用。
{"aps":{"alert":"Enter your message","badge":1}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.