Clearing a single notification in iOS 11.2 clears them all

285 Views Asked by At

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];
3

There are 3 best solutions below

0
strangetimes On BEST ANSWER
0
Harish Rathuri On

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
boformer On

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.