在iOS 10中,我使用新的frameWork UNNotification .When设置UNNotificationTrigger,我想在UNNotification上设置一个点火日期。但我找不到在UNNotificationTrigger的属性中设置点火日期。那么我如何在UNNotificationTrigger中设置一个火日期呢?我想在UNNotificationTrigger中设定一个点火日期,我如何设置?
发布于 2016-12-15 06:03:24
用户通知框架中有两种类型的触发器:
您的解决方案(Swift 3)是将您的日期转换为dateComponent,这可以通过以下方法完成:
import UserNotifications
var newComponents = Calendar.current.dateComponents([.year,.month,.day,.hour,.minute,.second,], from: date)
let trigger = UNCalendarNotificationTrigger(dateMatching: newComponents, repeats: false)https://stackoverflow.com/questions/41155967
复制相似问题