Unnotification with timedelay sometimes not working iOS swift

Solution:

I had faced the problem that i had give time for unnotification at a particular time like now or after few seconds.but sometimes it was not triggered.So i changed the code from

let trigger = UNCalendarNotificationTrigger(dateMatching: triggerDate,                                                repeats: true)

To

        let trigger = UNTimeIntervalNotificationTrigger(timeInterval: TimeInterval(delay),
                                                        repeats: false)


It was working good. If you want to trigger a notification to current time use the above code or if you want to trigger a notification at next hour or some date then use the dae based trigger.

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift