iOS 判斷是否允許app消息推送

直接貼代碼如下

+(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;
}
}
發佈了30 篇原創文章 · 獲贊 0 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章