Find list of Local Notification the app has already set

后端 未结 8 1831
盖世英雄少女心
盖世英雄少女心 2020-12-01 05:37

My app allows users to set a number of reminders in the future. When the app lauches I want to know what reminders (notifications) have already been set.

Can I read

相关标签:
8条回答
  • 2020-12-01 06:06

    Swift 3.0.2:

    UIApplication.shared.scheduledLocalNotifications
    
    0 讨论(0)
  • 2020-12-01 06:07

    @Scott Berrevoets gave the correct answer. To actually list them, it is simple to enumerate the objects in the array:

    [[[UIApplication sharedApplication] scheduledLocalNotifications] enumerateObjectsUsingBlock:^(UILocalNotification *notification, NSUInteger idx, BOOL *stop) {
        NSLog(@"Notification %lu: %@",(unsigned long)idx, notification);
    }];
    
    0 讨论(0)
提交回复
热议问题