直接貼代碼如下
+(BOOL)notification{
if(IS_IOS8){
BOOL isRemoteNotify = [UIApplication sharedApplication].isRegisteredForRemoteNotifications;
return isRemoteNotify;
}else{
UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
int typeBadge = (type & UIRemoteNotificationTypeBadge);
int typeSound = (type & UIRemoteNotificationTypeSound);
int typeAlert = (type & UIRemoteNotificationTypeAlert);
BOOL ret = !typeBadge || !typeSound || !typeAlert;
return ret;
}
}