По-видимому, теперь это возможно с помощью ios10:
optional func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: (UNNotificationPresentationOptions) -> Void)
В этом ответе в основном говорится о необходимых инструментах:
Отображение подписного баннера уведомлений iOS, когда ваше приложение открыто и на переднем плане?
Я просто не понимаю, как собрать все это.
Я не знаю, насколько это важно, но я не могу удержать дополнительный func, и xcode хочет, чтобы я переключил его на приватный.
Я пытаюсь показать значок, а документы предоставляют
static var badge: UNNotificationPresentationOptions { get }
Немного потерял здесь.
И затем я предполагаю, что если я хочу исключить определенный контроллер представления из этих значков, и я не использую контроллер навигации, этот код, который я нашел, будет работать?: var window: UIWindow?
if let viewControllers = window?.rootViewController?.childViewControllers {
for viewController in viewControllers {
if viewController.isKindOfClass(MyViewControllerClass) {
print("Found it!!!")
}
}
}