口袋优选

KBAuthorityManager.m 741B

123456789101112131415161718192021222324252627282930
  1. //
  2. // KBAuthorityManager.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/25.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBAuthorityManager.h"
  9. @implementation KBAuthorityManager
  10. +(BOOL)isObtainUserNotificationAuthority{
  11. BOOL isOpen = NO;
  12. #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0
  13. UIUserNotificationSettings *setting = [[UIApplication sharedApplication] currentUserNotificationSettings];
  14. if (setting.types != UIUserNotificationTypeNone) {
  15. isOpen = YES;
  16. }
  17. #else
  18. UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
  19. if (type != UIRemoteNotificationTypeNone) {
  20. isOpen = YES;
  21. }
  22. #endif
  23. return isOpen;
  24. }
  25. @end