问题描述
我正在实施消息过滤器扩展,但在使用通知时遇到了问题。关键是我想为进入垃圾文件夹的每条消息触发通知。我在 MainViewController 中测试了通知的代码,它工作正常。波纹管是我正在使用的代码,我在 viewDidLoad() 方法中要求用户权限。
func sendNotification(){
print("sendNotification.....")
//creating the notification content
let content = UNMutableNotificationContent()
//adding title,subtitle,body and badge
content.title = "hey,test notification"
content.subtitle = "iOS Development is good"
content.body = "We are learning about iOS Local Notification"
content.badge = 1
//getting the notification trigger
//it will be called after 5 seconds
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5,repeats: false)
//getting the notification request
let request = UNNotificationRequest(identifier: "SimplifiedioSNotification",content: content,trigger: trigger)
UNUserNotificationCenter.current().delegate = self
//adding the notification to notification center
UNUserNotificationCenter.current().add(request,withCompletionHandler: nil) }
当邮件被过滤为垃圾邮件时,是否可以发送通知以通知用户? 谢谢开发者。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)