问题标签 [unusernotificationcenter]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ios - iOS如何在本地通知上启动后台任务
我试图实现以下目标。在发送预定的本地通知时,应启动后台任务来处理应用程序数据,这样用户就无需点击通知或将应用程序置于前台。我支持 iOS 9+
这是可能的,如果,怎么做?AFAIK 如果应用程序处于后台或非活动状态,则在 AppDelegate 或 UNUserNotificationCenterDelegate 中传递本地通知时不会触发任何事件。
ios - 本地通知未在 ios10 中触发
我正在使用UNUserNotificationCenter
ios 10。为了测试,我将本地通知设置为从当前时间开始 10 秒。
这是我试过的,
我可以看到日志“本地通知成功”。但是本地通知没有在设备中触发。
在 Appdelegate 中,我添加了
我做错什么了?为什么应用程序通知没有被触发?
ios - IOS 10 + Swift 2.3 中未调用本地通知
我用 swift 2.2 编写了用于注册和触发的旧代码UILocalNotification
。现在,当我在 xcode 8 中从 Swift 2.2 迁移到 2.3 并从 IOS 9 迁移到 IOS 10 时。之后我无法收到任何本地通知。此外,虽然在控制台中没有任何异常。可以确认它在 IOS 9 上运行良好。
这是我用来触发本地通知的代码。
我可以看到文档说此方法在 IOS 10 中已被弃用,需要UNUserNotificationCenter
改用。但要使用它,我需要升级到 Swift 3.0。
因此,我的问题是,它是 Swift 2.3 中的错误/漏洞吗?我们有什么解决办法吗?还是我错过了什么?
ios - 多个 UNUserNotifications 未触发
我正在设置多个 UNUsernotifications,如下所示,
在该set10Notif
方法中,我设置了多个(8 个用于测试)通知,时间距当前时间 10 秒。
所有本地通知均已设置。但是设备中只有一个通知被触发,这是最后一个。
为什么多个通知不能不触发?我做错什么了?
ios - 如何在 iOS 10 中添加多个本地通知?
如何安排多个本地通知。在 iOS 10UILocalNotification
中更改为UNUserNotificationCenter
.
但我没有得到如何根据日期/时间添加多个通知。以及如何在单击通知栏中的特定通知时处理该通知。
以下是我的代码片段:
//这是我的 App 委托方法 -------
//这是我的视图控制器 --------
我不知道如何添加多个通知以及如何处理。我从过去 2 天开始就被困住了。
请知道的人帮帮我....
ios - iOS 10 如何使用 UNUserNotificationCenter 查看待处理通知列表?
解决方案代码:
我的原帖:
我正在尝试通过 UNUserNotificationCenter 获取UIApplication.shared.scheduledLocalNotifications
已折旧的待处理通知列表。
这是我正在使用的代码:
但是,这会打印“(功能)”。getPendingNotificationRequests 需要一个 UNUserNotificationCenter 参数,我想不出它还能是什么。
谢谢
ios - 保持 UNNotificationContent 几秒钟
我正在为 iOS 10 在 Swift 3 中做一个应用程序。我已经做了一个 UNNotificationContent 来模拟我的应用程序中的呼叫,但它在启动后大约五秒钟消失了。我需要保持更多秒,而“呼叫”正在进行中。我想保留本地通知,直到我调用 removeAllPendingNotificationRequests 方法。我可以做吗?
这是我现在的代码:
谢谢!