ios - 使用 iOS UNUserNotificationCenter,如何设置闹钟的开始和结束时间?
问题描述
使用 iOS UNUserNotificationCenter 我可以设置闹钟的开始和结束时间吗?
例如,我想每天早上 7:00 到晚上 10:00 设置闹钟,重复间隔为 30 分钟。
喜欢这个应用程序。
我的代码如下。
UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: [id.uuidString])
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: TimeInterval(repeatTypeFromNow * 60), repeats:true)
let request = UNNotificationRequest(identifier: id.uuidString, content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
是否可以在无服务器环境中使用?
解决方案
推荐阅读
- r - 轴覆盖图中的标签
- angular - 用户登录后如何设置令牌?
- windows - 在 Windows 10 上查找或编译最新的 GNU RCS (5.10)
- java - 在 Android Studio 中更新数据错误,但 API 有效
- regex - Oracle正则表达式匹配列值的多个部分
- php - 在 Laravel 中,如何为不同的客户名称制作多个仪表板?
- python - 将 2 个列表的公共元素存储为 0 和 1
- reactjs - 如何在 next.js 上正确实现 next/link 与 SSR
- python - 在 Python 中使用函数更改变量值
- python - 我可以在 python 中拆分推文数据吗?