有什么方法可以强制 UILocalNotification 默认为警报?
Is there any way to force UILocalNotification to be an alert by default?
我正在寻找一种默认情况下发出 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
我正在寻找一种默认情况下发出 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