我需要从特定日期起每48小时发出一次通知 . 我可以使用 UNTimeIntervalNotificationTrigger 安排它 -

let trigger : UNTimeIntervalNotificationTrigger = UNTimeIntervalNotificationTrigger.init(timeInterval: TimeInterval(48 * 60 * 60), repeats: true);
let content = UNMutableNotificationContent()   
   // Set the content whatever you want like title, subtitle, sound, userInfo 

let request = UNNotificationRequest(identifier: alertId, content: content, trigger: trigger);

我的问题是如何设置 fireDate . 我需要从未来的日期开始这个通知,但使用它,它从今天开始 .

我也尝试使用 UNCalendarNotificationTrigger (使用组件 [.hour, .minute] ),但它每天都会重复,因为每天特定的小时和分钟匹配 . 我也遵循堆栈溢出的其他解决方案,但仍然没有得到任何解决方案 .