ios - 有什么方法可以强制 UILocalNotification 默认为警报?

标签 ios swift uilocalnotification

<分区>

我正在寻找一种默认情况下发出 UILocalNotifcations 警报的方法。

由于横幅在选项选择方面受到限制,我想将警报设置为默认通知类型。

let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Sound]

上面的行是不够的,它一直将默认通知类型设置为横幅。

通知用户进入设置并将其更改为闹钟是非常糟糕的用户体验。

最佳答案

这是不可能的,因为它取决于用户设置的设置。

根据文档:

The user can change the notification settings for your app at any time using the Settings app. Because settings can change, always call the registerUserNotificationSettings: at launch time and use the application:didRegisterUserNotificationSettings: method to get the response. If the user disallows specific notification types, avoid using those types when configuring local and remote notifications for your app. 1

关于ios - 有什么方法可以强制 UILocalNotification 默认为警报?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35408859/

相关文章:

swift - 如何获得二进制包的校验和?

ios - 通知触发时播放视频

lua - 电晕,system.scheduleNotification 无法正常工作

ios - 如何检测从WebView网址开始播放的音频文件

ios - 在 ScrollView 中切换具有不同高度的容器或 View

Swift - 解析 "Signing Up"错误

ios - 在 Combine 中处理发布者错误的最佳实践是什么? (从 CoreLocation 发布航向更新)

ios - 远程服务器不可用时的本地通知

ios - 如何在 UITableViewCell 中调整 UIImageView 的大小?

ios - iOS中最窄的字体是什么