美文网首页iOS 控件详解
UNUserNotificationCenter

UNUserNotificationCenter

作者: 风冰武 | 来源:发表于2019-03-05 13:47 被阅读0次
//iOS 10有用          22行
typedef NS_OPTIONS(NSUInteger, UNAuthorizationOptions) {
    UNAuthorizationOptionBadge,     //边角
    UNAuthorizationOptionSound,     //声音
    UNAuthorizationOptionAlert ,
    UNAuthorizationOptionCarPlay,
    UNAuthorizationOptionCriticalAlert,
    UNAuthorizationOptionProvidesAppNotificationSettings,
    UNAuthorizationOptionProvisional,
};

//管理通知的对象          37行
@interface UNUserNotificationCenter : NSObject
备注: iOS 10之后才可以使用

//返回通知中心对象          46行
//返回: 通知中心对象
+ (UNUserNotificationCenter *)currentNotificationCenter;

//当本地通知和远程通知传递到用户的设备时, 请求授权与用户交互          51行
//参数1: 请求的授权选项
//参数2: 与结果异步执行的块(参数: granted: 是否授权, error:错误)
- (void)requestAuthorizationWithOptions:(UNAuthorizationOptions)options completionHandler:(void (^)(BOOL granted, NSError *__nullable error))completionHandler;

































相关文章

网友评论

    本文标题:UNUserNotificationCenter

    本文链接:https://www.haomeiwen.com/subject/aspnuqtx.html