0

从 iOS 11.2 开始,从我的应用程序中清除单个通知似乎将它们全部清除。由于没有更改任何代码,我似乎无法弄清楚发生了什么。

UNNotificationRequest是使用 GUID 创建的,具有普遍唯一性(因为我的应用程序允许用户基于相同的提醒类型创建多个警报)。

我一定做错了什么?

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

3 回答 3

0
于 2018-02-04T22:10:29.670 回答
0

我也只在 iOS 11.2 上遇到了同样的问题,现在我已经将我的操作系统 11.2 更新到了 11.3。现在它对我来说很好。

这是 iOS 11.3 中解决的与操作系统相关的错误。

于 2018-04-03T05:51:57.620 回答
0

另一个原因/解决方案:

如果您在没有 的静默通知到达时清除单个通知,请alert确保aps.batch未将其设置为 0。确保aps.batch您的消息中根本不包含该通知。

于 2018-10-15T01:18:18.727 回答