How to update code using enabledRemoteNotificationTypes because it is “not supported in iOS 8”?

前端 未结 3 2108
情书的邮戳
情书的邮戳 2020-12-15 09:11

this is the code i used for the RemoteNotificationType:

NSUInteger rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-15 09:37

    Use with this condition to give support in both iOS 7 and prior iOS 8

    #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
    
    NSUInteger rntypes;
      if (!SYSTEM_VERSION_LESS_THAN(@"8.0")) {
       rntypes = [[[UIApplication sharedApplication] currentUserNotificationSettings] types];
    }else{
       rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
    }
    

提交回复
热议问题