<分区>
我正在寻找一种默认情况下发出 UILocalNotifcations 警报的方法。
由于横幅在选项选择方面受到限制,我想将警报设置为默认通知类型。
let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Sound]
上面的行是不够的,它一直将默认通知类型设置为横幅。
通知用户进入设置并将其更改为闹钟是非常糟糕的用户体验。
<分区>
我正在寻找一种默认情况下发出 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/