didRegisterForRemoteNotificationsWithDeviceToken is not called up in ios 9

前端 未结 3 1058
旧巷少年郎
旧巷少年郎 2020-12-11 20:30

I have to implement APNS in my project, I have created APNS SSL in developer portal, and using this i have created new pro

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-11 21:17

    Try with this one.

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0){
    
        UIUserNotificationType types = UIUserNotificationTypeBadge |
        UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
    
        UIUserNotificationSettings *mySettings =
        [UIUserNotificationSettings settingsForTypes:types categories:nil];
    
        [application registerUserNotificationSettings:mySettings];
        [application registerForRemoteNotifications];
    
    
    }else{
        [application registerForRemoteNotificationTypes:
         (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
    }
    

提交回复
热议问题