最終更新:2017-07-11 (火) 05:00:42 (2453d)
UserNotifications
Top / UserNotifications
https://developer.apple.com/documentation/usernotifications
主なクラス
- UNUserNotificationCenter
- UNNotificationCategory?
- UNMutableNotificationContent?
- UNNotificationRequest
条件
主な処理
- UNUserNotificationCenter addNotificationRequest:withCompletionHandler:?
例
let content = UNMutableNotificationContent() content.title = NSString.localizedUserNotificationString(forKey: "Wake up!", arguments: nil) content.body = NSString.localizedUserNotificationString(forKey: "Rise and shine! It's morning time!", arguments: nil) // 午前7時のモーニングコール用にトリガを設定。 var dateInfo = DateComponents() dateInfo.hour = 7 dateInfo.minute = 0 let trigger = UNCalendarNotificationTrigger(dateMatching: dateInfo, repeats: false) // リクエストオブジェクトを生成。 let request = UNNotificationRequest(identifier: "MorningAlarm", content: content, trigger: trigger)