0

Since iOS 11.2, clearing a single notification from my app seems to clear them all. I can't seem to figure out what's happening as no code was changed.

My UNNotificationRequest are created with GUUIDs to be universally unique (since my app allows users to create multiple alerts based on the same reminder type).

What must I be doing wrong?

UNMutableNotificationContent *alertContent = [[UNMutableNotificationContent alloc] init];
alertContent.categoryIdentifier = ALERT_CATEGORY_ALERTS;
alertContent.body = task.title;
alertContent.userInfo = ... a dictionary of stuff

...

NSDateComponents *dateCompos = [localGregCal components:NSCalendarUnitYear | NSCalendarUnitMonth 
| NSCalendarUnitDay | NSCalendarUnitHour | 
NSCalendarUnitMinute | NSCalendarUnitSecond fromDate:deliveryDate];

UNCalendarNotificationTrigger *alertTrigger = [UNCalendarNotificationTrigger 
triggerWithDateMatchingComponents:dateCompos repeats:NO];

UNNotificationRequest *notifRequest = [UNNotificationRequest requestWithIdentifier:NEW_GUUID
 content:alertContent trigger:alertTrigger];
strangetimes
  • 4,953
  • 1
  • 34
  • 62

3 Answers3

0

Appears to be an iOS 11.2.0-.5 issue:

rdar://36575570: iOS 11.2.2: Clearing/Action on notification causes …

LinusGeffarth
  • 27,197
  • 29
  • 120
  • 174
strangetimes
  • 4,953
  • 1
  • 34
  • 62
0

I have also face the same issue only with iOS 11.2 and now I have update my OS 11.2 to 11.3. Now it's working fine for me.

So this is the OS related bug which is resolved in iOS 11.3.

0

Another cause/solution:

If you are clearing a single notification upon arrival of a silent notification without an alert, make sure that aps.batch is not set to 0. Make sure that aps.batch is not included in your message at all.

boformer
  • 28,207
  • 10
  • 81
  • 66