使用iOS 10中的UNNotificationSettings检查通知类型

时间:2016-09-26 10:48:21

标签: ios cocoa-touch ios10 usernotifications

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

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

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

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

1 个答案:

答案 0 :(得分:7)

我希望你问这个

if (document.ThumbnailPart == null)
    document.AddThumbnailPart(ThumbnailPartType.Jpeg);

var thumbNailPart = document.ThumbnailPart;

Swift 4

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

对于Objective-C

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