0 Replies
      Latest reply on Dec 2, 2019 10:40 PM by O.Okmen
      O.Okmen Level 1 Level 1 (0 points)

        I create local push notifications with a notID and after that, in deletion process i delete it with the following code block;

        NSString *myIDToCancel = [NSString stringWithFormat: @"m%@", object.reminderID];
        UILocalNotification *notificationToCancel=nil;

        for(UILocalNotification *aNotif in [[UIApplication sharedApplication] scheduledLocalNotifications]) {
          if([[aNotif.userInfo objectForKey:@"notID"] isEqualToString:myIDToCancel]) {
          [[UIApplication sharedApplication] cancelLocalNotification:notificationToCancel];
        // break;

        I commented the break; because there can be more than 1 notification with same ID -like 4 times a day notification with 6 hours between have same notID- so i can check all notifications before going out of the for loop.

        It used to work perfect, but now it is not. While debugging i can see it checks and cancels one by one every notification, but after that local notification fires up even its cancelled.


        i also checked the scheduledLocalNotifications with:

        NSArray *localNotifications = [[UIApplication sharedApplication] scheduledLocalNotifications];


        code block and it shows 0 elements after deletion, but it still fires up.