首先导入#import <UserNotifications/UserNotifications.h>
[[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
if (settings.authorizationStatus == UNAuthorizationStatusNotDetermined)
{
NSLog(@"未选择---没有选择允许或者不允许,按不允许处理");
}else if (settings.authorizationStatus == UNAuthorizationStatusDenied){
NSLog(@"未授权--不允许推送");
}else if (settings.authorizationStatus == UNAuthorizationStatusAuthorized){
NSLog(@"已授权--允许推送");
}];