scheduled local notification is not being stored in the scheduledLocalNotification array

后端 未结 3 1774
走了就别回头了
走了就别回头了 2021-01-22 04:15

I am currently scheduling local notifications to appear once per day at 6PM if a user has not already opened the app that day. If the user has already loaded the application, th

相关标签:
3条回答
  • 2021-01-22 04:53
    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.

    0 讨论(0)
  • 2021-01-22 05:00

    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.

    0 讨论(0)
  • 2021-01-22 05:03

    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);
    
    0 讨论(0)
提交回复
热议问题