swift 3 中的 UNUserNotificationCenter 图标应用程序通知不干净?
UNUserNotificationCenter not clean notification of icon app in swift 3?
我有问题。我的应用程序中有一条通知。我正在尝试这个。但是现在,我无法从图标应用程序中删除。
我运行这个代码:
UNUserNotificationCenter.current().getPendingNotificationRequests(completionHandler: {requests -> () in
print("\(requests.count) requests -------")
for request in requests{
print(request.identifier)
}
UNUserNotificationCenter.current().removeAllPendingNotificationRequests()
})
UNUserNotificationCenter.current().getDeliveredNotifications(completionHandler: {deliveredNotifications -> () in
print("\(deliveredNotifications.count) Delivered notifications-------")
for notification in deliveredNotifications{
print(notification.request.identifier)
}
UNUserNotificationCenter.current().removeAllDeliveredNotifications()
})
痕迹是这样的:
0 个请求 ------
0 条已发送的通知--------
在图标应用中,我看到了这个:
Im can't up image :( but in this, i see a number one on the icon app and red foreground
Yayo 您需要将徽章计数设置为 0
才能从您的应用程序图标中删除徽章计数。为此 -
UIApplication.shared.applicationIconBadgeNumber = 0
我有问题。我的应用程序中有一条通知。我正在尝试这个。但是现在,我无法从图标应用程序中删除。
我运行这个代码:
UNUserNotificationCenter.current().getPendingNotificationRequests(completionHandler: {requests -> () in
print("\(requests.count) requests -------")
for request in requests{
print(request.identifier)
}
UNUserNotificationCenter.current().removeAllPendingNotificationRequests()
})
UNUserNotificationCenter.current().getDeliveredNotifications(completionHandler: {deliveredNotifications -> () in
print("\(deliveredNotifications.count) Delivered notifications-------")
for notification in deliveredNotifications{
print(notification.request.identifier)
}
UNUserNotificationCenter.current().removeAllDeliveredNotifications()
})
痕迹是这样的:
0 个请求 ------ 0 条已发送的通知--------
在图标应用中,我看到了这个:
Im can't up image :( but in this, i see a number one on the icon app and red foreground
Yayo 您需要将徽章计数设置为 0
才能从您的应用程序图标中删除徽章计数。为此 -
UIApplication.shared.applicationIconBadgeNumber = 0