问题标签 [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 - 如何在没有 OneSignal 和 Swift 2.3 的 UserNotifications 框架的情况下使用 iOS 10 的通知?
我试图让我的用户通过 OneSignal 接收通知,但我使用的是 Swift 2.3 并且有一台无法升级到 XCode 8 的旧版 Macbook。这可能吗?如何?这是建议的 OneSignal Swift 代码...
swift - 使用更改重复间隔触发 UNUserNotification 触发器
我已经阅读了有关新用户通知框架的所有 Apple 文档,我被正式难住了。
我需要设置一个在几天UNNotificationRequest
后触发X
。这可以通过UNTimeIntervalNotificationTrigger
. 但是,问题是我需要此通知然后每天重复Y
。whereY
不一定等于X
。
我最初以为我可以简单地安排第二个 UNNotificationRequest 以 Y 的时间间隔重复,但随后它会在第一个X
日期过去之前触发,或者不会在正确的时间间隔内触发。
例如,如果我从现在开始安排一个通知 3 天,然后希望该通知在它触发后每天重复,如果不设置我自己的调度系统以在后台唤醒应用程序并检查是否是时候安排第二个 UNNotificationRequest 了吗?
ios - 当应用程序终止或在后台显示本地通知时执行某些操作
我知道只有当应用程序处于前台状态时才会调用 will present 方法。现在,如果用户忽略通知,我希望应用程序执行某些操作。在这种情况下,我想在下次启动期间展示另一个视图控制器(当通知被忽略时)。我希望在应用程序处于后台或应用程序终止时调用 will present 方法。任何帮助将不胜感激
ios - iOS 10 (Swift) 拒绝通知权限
我想在我的应用程序中有一个 UISwitch,当按下它时将请求通知授权,或者如果已经授权拒绝它。
有没有办法执行拒绝?我知道如果调用 requestAuthorization 并且用户已经授权了应用程序,那么什么都不会发生。所以我很好奇应用程序中是否有一种方法可以删除通知权限,而无需强制用户转到其设备上的设置应用程序并从那里进行操作。
ios - iOS, swift, 目标 C, UserNotificationCenter, NSNotificationCenter
我有一个现有的项目,我们使用 NSNotificationCenter 构建了它。现在,如果我想向我的应用程序添加丰富的通知,是否应该将所有 NSNotification 调用都替换为 NSUserNotification?
当我尝试通知服务扩展时,如果没有更换,就永远不会调用远程和本地通知。
ios - Repeating local notifications iOS 10
Has anyone been successful at scheduling a repeating hourly local notification with UNUserNotificationCenter without creating multiple request?
I need to be able to schedule hourly notifications to go off at a specific minute from which the first notification is set to go off. I am able to do this using the old UILocalNotification framework but I want to be able to take advantage of notification extensions, titles, subtitles etc that come along with the new notifications framework.
If it's not possible to schedule a single request that repeats hourly at a specific time, has anyone found a way to achieve this using multiple requests? And doing so without requiring the user to action against the first notification?
My other concern with scheduling multiple requests is that my app allows a user to create multiple reminders and I don't want to limit the user due to the 64 notification cap
Edit: My current use case is, it's 6:30am and I want to schedule a notification to trigger at 10:43 pm and from that point repeat hourly at 43 minutes past every hour. This is currently achievable with UILocalNotification using repeatInterval and setting the units to hour, so it will fire at that time and every hour after
ios - 为什么我的本地通知没有在 iOS 10 的前台触发?
我试图理解为什么本地通知没有显示在前台。我相信我添加了所有正确的代码以实现此功能,但是当我的应用程序处于前台时,没有显示横幅。
这是我添加的内容AppDelegate.swift
:
我的ViewController.swift
:
当我的应用程序第一次启动时,我确实看到了允许我的应用程序推送通知的权限警报,但我根本看不到任何通知。
我确实看到了日志输出GO IN HERE,所以willPresent
被调用了。
还有什么我想念的吗?
swift3 - 如何在 iOS 10(Swift)中取消特定的定期本地通知并将其重新安排到下周
我创建了不同的本地通知来设置工作日和周末连续重复
并取消特定通知,根据适当的条件使用通知进行验证,并在下周更新相同的通知。
并使用更新下一个开火日期
即使由于重复“真”而删除了已删除日期的通知触发。
是否有在 iOS 10 的本地通知中添加开始日期的选项?
提前致谢!!
ios - 无法从通知操作处理程序打开 URL
我正在尝试通过在 iOS 10 / Swift 3 上打开 URL 来处理本地通知。我将一个 URL 分配给通知的默认操作,另一个分配给自定义操作按钮。
当触发默认操作(点击通知本身)时,应用程序会成功打开 URL。但是当点击操作按钮时,UNUserNotificationCenterDelegate
会调用处理程序并canOpenURL
返回 true,但打开 URL 的调用失败。
仅当应用程序在后台或在点击通知时终止时才会出现此问题。如果应用程序在前台,这两种情况都有效。
我的应用程序委托的application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:])
方法中也有一个断点。它会命中默认操作,但不会命中自定义操作。
在处理自定义操作时,我需要做一些不同的事情吗?
这是代码: