application:didReceiveLocalNotification never called on ios 8

前端 未结 4 771
耶瑟儿~
耶瑟儿~ 2020-12-17 03:32

Is there any known problem issue with:

application:didReceiveLocalNotification delegate

on iOS 8?

My application creates local noti

4条回答
  •  时光说笑
    2020-12-17 04:13

    I meet the same problem...

    You must change to use the following code:

    // register notification for push mechanism        
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings
                                                                                 settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)
                                                                                 categories:nil]];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    } else {
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
             (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
    }
    

    to instead of the original:

    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
    

提交回复
热议问题