jjzjj

UNUserNotificationCenter

全部标签

ios - Firebase 云消息传递 AppDelegate 错误

这是Firebase文档中的代码。if#available(iOS10.0,*){letauthOptions:UNAuthorizationOptions=[.Alert,.Badge,.Sound]UNUserNotificationCenter.currentNotificationCenter().requestAuthorizationWithOptions(authOptions,completionHandler:{_,_in})//ForiOS10displaynotification(sentviaAPNS)UNUserNotificationCenter.curre

ios - 在应用程序处于前台 Swift 3 时获取本地通知以显示

显然,这现在可以通过ios10实现:optionalfuncuserNotificationCenter(_center:UNUserNotificationCenter,willPresentnotification:UNNotification,withCompletionHandlercompletionHandler:(UNNotificationPresentationOptions)->Void)这个答案基本上说明了执行此操作所需的工具:DisplayingastockiOSnotificationbannerwhenyourappisopenandintheforegro

ios - 在应用程序处于前台 Swift 3 时获取本地通知以显示

显然,这现在可以通过ios10实现:optionalfuncuserNotificationCenter(_center:UNUserNotificationCenter,willPresentnotification:UNNotification,withCompletionHandlercompletionHandler:(UNNotificationPresentationOptions)->Void)这个答案基本上说明了执行此操作所需的工具:DisplayingastockiOSnotificationbannerwhenyourappisopenandintheforegro

ios - 如何处理 Swift 3 中 UNUserNotificationCenter 和 FIRMessaging w/Firebase 的委托(delegate)?

我正在尝试使用Firebase在我的应用程序中实现推送通知,但是在按照他们的文档进行操作时,我必须添加以下代码行:if#available(iOS10.0,*){letauthOptions:UNAuthorizationOptions=[.alert,.badge,.sound]UNUserNotificationCenter.current().requestAuthorization(options:authOptions,completionHandler:{_,_in})UNUserNotificationCenter.current().delegate=selfFIRMe

ios - 等到使用 removePendingNotificationRequests 删除来自 UNUserNotificationCenter 的本地通知 ios 10 swift 3

使用来自UNUserNotificationCenter的新本地通知。我尝试删除带有一些标识符的通知:UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers:identifiers)来自文档:Thismethodexecutesasynchronously,removingthependingnotificationrequestsonasecondarythread.完成处理程序不存在。那么我怎么知道它什么时候真的被删除了呢?在继续之前,我需要确保此标识符不再存在。我知道

ios - 即使在将相同的线程标识符设置为 UNMutableNotificationContent 后,UNUserNotificationCenter 也不会将通知组合在一起

我正在为iOS10生成本地通知。以下是我的示例代码。UNUserNotificationCenter*nCentre=[UNUserNotificationCentercurrentNotificationCenter];[nCentrerequestAuthorizationWithOptions:(UNAuthorizationOptionBadge+UNAuthorizationOptionAlert+UNAuthorizationOptionSound)completionHandler:^(BOOLgranted,NSError*_Nullableerror){}];UNMu

ios - 使用 UNUserNotificationCenter 后没有调用 didReceiveLocalNotification

我正在安排本地通知。它适用于iOS9.x,但自iOS10以来-(void)application:(UIApplication*)applicationdidReceiveLocalNotification:(UILocalNotification*)notification当应用程序在iOS10上运行时不会被调用。我知道iOS引入了新的UserNotifications框架,但这不应该停止iOS9API的工作。我该如何解决这个问题? 最佳答案 如您所知,iOS10引入了UNUserNotifications框架来处理本地和远程通知

ios - bundleIdentifier != nil 当通过 UNUserNotificationCenter.current().requestAuthorization 请求 iOS10 通知授权时

我遇到一个崩溃,说我的bundleID是nil2016-08-3110:39:11.630WeatherHop[52533:17767791]*Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason:'Invalidparameternotsatisfying:bundleIdentifier!=nil'*Firstthrowcallstack:使用此代码失败:letbundleIdentifier=Bundle.main.bundleIdentifierprint("\(bundleI

ios - UNUserNotificationCenter 需要willPresent代码

我有一个用Swift编写的应用程序,它使用UNUserNotificationCenter,当该应用程序位于前台时,它会显示通知。我想做的是在通知已发送且应用程序位于前台后更新UI以下显示的通知很好,但是当它显示时,我还想执行一个名为updateUI()的函数因为通知日期在我的UI中,我想在通知出现后立即清除它。funcuserNotificationCenter(_center:UNUserNotificationCenter,willPresentnotification:UNNotification,withCompletionHandlercompletionHandler:@

ios - 使用 UNUserNotificationCenter 支持 iOS 10 丰富的通知,但通知永远不会出现。它只会发出警报

不确定,缺少什么,但我遇到了一个奇怪的问题!!!通知会响起,但不会显示。我已将应用程序注册为仅显示警报和声音,但奇怪的是它从未显示过。可以看到通知添加成功。但是,似乎有些琐碎的事情我无法理解。即使删除通知也可以。importFoundationimportNotificationCenterimportUserNotificationsclassNotificationManager:NSObject{privateletcategoryIdentifier="notificationCategory"privatevartoDateComponents=NSDateComponent