last day (14 days later) » 

15:52
0
Q: iOS local notification not firing second time

Jamshed AlamI have implemented iOS 10 local notification where it works for the first alarm but not for other. I have import iOS 10 library , implemented delegate , receiving it first time in the delegate but it just not firing later. My date formate looks like : 2017-05-28 14:04:07 +0000 NSCalendar *c...

try printing the identifier you are setting for each trigger to check if they are different or not. Also how are you testing the notification? By manually changing the time on the device or waiting for the time?
identifier is different in my NSLog. Even i appended an extra random string into my identifier. And I am checking the alarm on simulator. I set 3 separate alarm. And i set my macbook time near to first alarm. When it works, then again i changed my macbook time near to second alarm and run my project. But it does not work for second or other alarm. @bhakti123
Check if all the alarms are scheduled or not. And what is their next trigger date. Then try to change the timing according to that trigger date and see if it works.
What do you mean by scheduled ? How could i check it ? My compss contains the firedate of the alarm which i set to trigger. @ bhakti123
you can check the scheduled alarms by using getpendingnotificationrequests
15:52
I am getting the pending or not played alarm in getpendingnotificationrequests in the array :( @ bhakti123
Yes, in that list can you see your notifications?
Yes, i see notification on correct time in my notification array . I set macbook time 2/3 minutes ago, and run, start waiting. But the time crosses, it never show alarm or call alarm firing delegate!
explain to me this, You get all the pending notification requests from the function. then check request identifier and its next firedate. Then set you macbook time accroding to the firedate and see if it fires or not
UNUserNotificationCenter.current().getPendingNotificationRequests(completionHandler: {requests in
if requests.count > 0 {
self.isSet = true
var freq = requests[0]
var fd = Date()
if let trigger = freq.trigger as? UNCalendarNotificationTrigger {
fd = trigger.nextTriggerDate()!
} else if let trigger = freq.trigger as? UNTimeIntervalNotificationTrigger {
fd = trigger.nextTriggerDate()!
}
I am doing it on obj c
ok.
But use this logic to get the next trigger date of the notification you are trying to test
to check if you have set it correctly
and then change the date on your emulator to that time
sont change the macbook date
in your emulator, go to settings and manually change the date as you would do on a normal phone
16:03
simulator use system kernal time
so, there is no option of changing time from simulator may be
16:31
no, in the simulator, press the hardware home button
and try
then go in settings
and change the date and time settings

last day (14 days later) »