ios App Push Notification Devices and Non-Application Devices

Asked 2 years ago, Updated 2 years ago, 67 views

There are devices that are not notified by push notification and notification center in the application currently under development.
I would appreciate it if you could tell me the possible causes of the following conditions.
Even if you can't be sure, it's a possible cause.

How Notifications Work
①User sets time
②Notify Silent Push
③Access the server from the app side to get updates
④Push notification of updates to notification center

About Notifications

When starting the application (foreground)
iphone6 <
iphone6-2 <
iphone6-3 <
iphone6s <
iphone7x
iphone7x

End of Application (Background)
iphone6 <
iphone 6-2x
iphone 6-3x
iphone6s <
iphone7x
iphone7x

iphone sleep (background)
iphone6 <
iphone 6-2x
iphone 6-3x
iphone6s <
iphone7x
iphone7x

US>Version
iphone6 10.3.1
iphone 6-210.3.1
iphone 6-310.2.1
iphone 6s 10.3.1
iphone 7 10.3.1
iphone 7 10.3.1

Other Conditions
US>All notification settings are turned on
Install from testflight
US>Install on a total of 6 units
3 iphone 6s Results are the same for both 4G lines and wifi environments

ios

2022-09-30 21:24

2 Answers

One thing I would like to point out is where registerForRemoteNotifications runs.

 if(floor(NSFoundationVersionNumber)<=NSFoundationVersionNumber_iOS_9_x_Max){
    // iOS 9 and below
    UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
    UIUserNotificationSettings*settings=[UIUserNotificationSettingsForTypes:types categories:nil];
    [[UIAApplication sharedApplication] registerUserNotificationSettings:settings];
    [[UIAApplication sharedApplication] registerForRemoteNotifications];
} else{
    // iOS 10 or higher
    UNAUTHORIZATIONOptions = UNAUTHORIZATIONOptionAlert | UNAUTHORIZATIONOptionBadge | UNAUTHORIZATIONOptionSound;
    [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:options completionHandler:^(BOOL graded, NSError*_Nullable error){
        if(granted){
            // US>Notification allowed or allowed
            [[UIAApplication sharedApplication] registerForRemoteNotifications];
        }
    }];
    [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
}

iOS 10 and later run requestAuthorizationWithOptions to display notification authorization alerts to users.
Since this result will enter granted, run registerForRemoteNotifications only if the user explicitly permits notification.


2022-09-30 21:24

Thank you for your reply.
Thank you very much for giving me detailed instructions, which could be a clue to finding the cause.
First, we will try to log the server to determine the cause.

And what do you think of this code for this problem?

 if(floor(NSFoundationVersionNumber)<=NSFoundationVersionNumber_iOS_9_x_Max){
        UIUserNotificationType allNotificationTypes=
        (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
        UIUserNotificationSettings*settings=
        UIUserNotificationSettings settingsForTypes: allNotificationTypes categories:nil;
        [[UIAApplication sharedApplication] registerUserNotificationSettings:settings];
    } else{
        // iOS 10 or later

        UNAauthorizationOptions authOptions=
        UNAUTHORIZATION OPTION
        | UNAUTHORIZATION OPTION
        | UNAUTHORIZATION OPTIONBADGE;
        [UNUserNotificationCenter currentNotificationCenter]
         requestAuthorizationWithOptions —authOptions
         completionHandler:^(BOOL graded, NSError*_Nullable error){
         }
         ];

        // For iOS 10 display notification (sent via APNS)
        [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
        // For iOS 10 data message (sent via FCM)

    }

    [[UIAApplication sharedApplication] registerForRemoteNotifications];


2022-09-30 21:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.