判断是否开启推送
/**
* check if user allow local notification of system setting
*
* @return YES-allowed,otherwise,NO.
*/
+ (BOOL)isAllowedNotification {
//iOS8 check if user allow notification
if ([UIDevice isSystemVersioniOS8]) {// system is iOS8
UIUserNotificationSettings *setting = [[UIApplication sharedApplication] currentUserNotificationSettings];
if (UIUserNotificationTypeNone != setting.types) {
return YES;
}
} else {//iOS7
UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if(UIRemoteNotificationTypeNone != type)
return YES;
}
return NO;
}
以上为判断是不是开启了推送
/**
* check if the system version is iOS8
*
* @return YES-is iOS8,otherwise,below iOS8
*/
+ (BOOL)isSystemVersioniOS8 {
//check systemVerson of device
UIDevice *device = [UIDevice currentDevice];
float sysVersion = [device.systemVersion floatValue];
if (sysVersion >= 8.0f) {
return YES;
}
return NO;
}
以上判断是不是iOS8
本文来自博客园,作者:赫凯,转载请注明原文链接:https://www.cnblogs.com/heKaiii/p/15491351.html

浙公网安备 33010602011771号