概述:UserNotifications 最新 iOS10 蘋果推出的? UserNotifications框架(UserNotifications.framework)支持本地和遠程通知的交付和處理吵血。你使用這個框架的類來安排當(dāng)?shù)赝ㄖ慕桓痘谔囟ǖ臈l件,如時間或地點。應(yīng)用程序和擴展也用這個框架來接收并可能修改本地和遠程通知當(dāng)他們交付給用戶的設(shè)備。
UNNotificationSettings 獲取通知一些設(shè)置信息
1? UNAuthorizationStatus : 通知授權(quán)狀態(tài) ,是一個枚舉類型
? notDetermined 沒有聲明 用戶沒有選擇程序是否可能發(fā)布用戶通知?
?denied 用戶堅決的拒絕,應(yīng)用程序不能授權(quán)和發(fā)送通知
?authorized 應(yīng)用程序獲取授權(quán)可以發(fā)送通知
2 UNNotificationSetting 表示某個功能是否支持使用,比如通知
case notSupported? // 這個應(yīng)用程序不支持聲音提醒,這個是你請求授權(quán)通知功能時沒有傳這個類型,比如 alert ,sound ,badge 缺少那個 那個狀態(tài)就是? soundSetting = notSupported?
// The notification setting is turned off.
case disabled // 用戶一開始是支持sound bagde alert 功能的 后來用戶在手機設(shè)置-通知中心把這個應(yīng)用某個支持類型給關(guān)閉了,所以這個功能也是不可用的,只需要重新打開才能使用
// The notification setting is turned on.
case enabled // 表示通知的這個類型是可以使用的,比如 soudSetting = enbaled 表示收到通知后有聲音提示
open var alertStyle: UNAlertStyle { get }? // 通知橫幅的樣式,比如在手機頂部彈窗通知,獲取在手機屏幕中間彈窗
case none 沒有彈窗提示
case banner // 頂部橫幅
case alert // 屏幕中間alert樣式
// Notification categories can be used to choose which actions will be displayed on which notifications.? ? open func setNotificationCategories(_ categories: Set)
?設(shè)置通知策略,收到通知后怎么去處理這個通知
UNNotificationActionOptions 執(zhí)行通知的一些策略
//? authenticationRequired 這一行動是否應(yīng)該被執(zhí)行前需要解鎖。
public static var authenticationRequired: UNNotificationActionOptions { get }
// destructive 是否應(yīng)該表示這個動作是破壞性的。類似于 刪除按
public static var destructive: UNNotificationActionOptions { get }
//? 這一行動是否應(yīng)該導(dǎo)致前臺應(yīng)用程序啟動遏佣。
public static var foreground: UNNotificationActionOptions { get }
好了,我是大兵布萊恩特,歡迎加入博主技術(shù)交流群霹菊,iOS 開發(fā)交流群
