gpt4 book ai didi

ios - 在 iOS 10 中使用 UNNotificationSettings 检查通知类型

转载 作者:可可西里 更新时间:2023-11-01 03:30:23 24 4
gpt4 key购买 nike

如何使用 UNNotificationSettings 获取 iOS 10 中的通知类型?

在以前的 iOS 上,我会使用这个:

UIUserNotificationSettings *notificationSettings = [[UIApplication sharedApplication] currentUserNotificationSettings];

Bool active = notificationSettings.types == UIUserNotificationTypeNone ? NO: YES;

最佳答案

我希望你问的是这个

UNUserNotificationCenter.currentNotificationCenter().getNotificationSettingsWithCompletionHandler{ (mySettings) in  mySettings.alertStyle == .None }

swift 4

UNUserNotificationCenter.current().getNotificationSettings{ (mySettings) in mySettings.alertStyle == .none }

对于 objective-c

[[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
settings.alertStyle == UNAlertStyleNone
}]

关于ios - 在 iOS 10 中使用 UNNotificationSettings 检查通知类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39700833/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com