省钱达人

DRAuthorityManager.m 741B

123456789101112131415161718192021222324252627282930
  1. //
  2. // DRAuthorityManager.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/25.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRAuthorityManager.h"
  9. @implementation DRAuthorityManager
  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