即使用户关闭系统设置屏幕中的通知(设置 - > AppName->通知)

时间:2018-04-16 04:56:52

标签: swift swift3

我使用以下代码推送本地通知。此代码仅在用户打开系统设置屏幕中的通知(设置 - > AppName->通知)时有效

@available(iOS 10.0, *)
func notifyUserNotification()
{
    let trigger =  UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)

    let content = UNMutableNotificationContent()

    content.title = "You have a new Recording !!"
    content.subtitle = "You have recorded 10mins recording"

    let request = UNNotificationRequest(identifier: "customNotification", content: content, trigger: trigger)

    UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)


}

0 个答案:

没有答案