I have a scenario where I want to add a local reminder of medication. The reminder can be daily or weekly of all medication which I used and duration of medicine can be in months. I already know that there is only 64 notification/app limit in iOS. Currently, I used a code with repeat true but notification work but I cannot restrict them to a specific date. Can anyone help me so I can set the notification for both daily and weekly and cannot cross the limit of 64?
let calender = Calendar.current
// let gmtZone = TimeZone(secondsFromGMT: 0)
// let dateFormatter = DateFormatter()
// dateFormatter.dateFormat = "yyyy-MM-dd HH:mm";
// dateFormatter.timeZone = gmtZone
// let dateString = dateFormatter.string(from: Date())
let date = Date()//dateFormatter.date(from: dateString)
var componentsFireDate = calender.dateComponents([.year, .day, .month,.hour ,.minute], from: date)
componentsFireDate.day = componentsFireDate.day! + expireIn
componentsFireDate.hour = hour
componentsFireDate.minute = minutes
componentsFireDate.second = 0
let fireDate = calender.date(from: componentsFireDate)
print("Date %@",fireDate!)
let center = UNUserNotificationCenter.current()
let content = UNMutableNotificationContent()
// content.title = title
content.body = body
content.sound = UNNotificationSound.default()
// content.categoryIdentifier = identifier
// let dailyComp = Calendar.current.dateComponents([.hour, .minute,.second], from: fireDate!)
let timeTrigger = UNTimeIntervalNotificationTrigger(timeInterval:60, repeats: true)
// let trigger = UNCalendarNotificationTrigger(dateMatching: dailyComp, repeats: false)
let request = UNNotificationRequest(identifier:identifier, content: content, trigger: timeTrigger)
center.add(request)