scheduled local notification is not being stored in the scheduledLocalNotification array

会有一股神秘感。 提交于 2019-12-01 22:45:14

Having similar issues right now. My guess here is that iOS does not schedule the notifications immediately but only at the end of the current run loop. I am running into these problems when setting the scheduledLocalNotifications property several times in the same run loop and changes don't seem to be updated accordingly. I think I will just keep a copy of the local notifications array myself and only set scheduledLocalNotifications and never read it.

sschunara
localNotification.fireDate = fireIn;

in this line check wheather "fireIn" is object of NSDate or NSString.

If it's NSString convert it into NSDate object with help of NSDateformatter and then assing it to localNotification fireDate.

I was facing same problem previously and resolved it with above mentioned steps.

if the schedule has invalid fire date, it will not get scheduled and result empty array returned, because there never has a valid one schedule, try to print out your localNotification like below, you may find out the problem.

NSLog(@"Notification--->: %@", localNotification);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!