how to implement multiple local notification not a single notification for swift 3

后端 未结 4 1322
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-15 17:03

i have use the single notification , and this is my code: this is for register the local notification>>>

    func registerLocal() {
    let center = UNUserNotifi         


        
4条回答
  •  南笙
    南笙 (楼主)
    2021-02-15 17:53

    You can call the func scheduleLocal() multiple times with different dateComponents to schedule on different dates. Or you can pass a array of dates to this function and run a loop to schedule the notifications according to these dates.

    Just make sure that the identifier you pass in UNNotificationRequest(identifier:, content:, trigger:) function is different for each notification.

    Hope this helps. :)

提交回复
热议问题