Cordova Plugin Register for Push Notifications

Code Block
#import <Cordova/CDV.h>
#import <UserNotifications/UserNotifications.h>
#import <Foundation/Foundation.h>
@interface plugin : CDVPlugin <UNUserNotificationCenterDelegate,UIApplicationDelegate> {
}
- (void)registerCloudMessagingToken:(CDVInvokedUrlCommand*)command;
@end
@implementation plugin
- (void)registerCloudMessagingToken:(CDVInvokedUrlCommand*)command
{
//Registering for notifications
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){
if( !granted ){
NSLog(@"User denied request to create notifications");
}
}];
[[UIApplication sharedApplication] registerForRemoteNotifications];
NSLog(@" Register for remote notifications" );
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler{
NSLog(@"didReceiveNotificationResponse");
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(UNNotification *)notification{
NSLog(@"openSettingsForNotification");
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler{
NSLog(@"willPresentNotification");
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
NSLog(@"hehehehe");
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{
NSLog(@"Failed to register device for push notifications");
}
@end


So thats the code, heheheh is never being printed. Despite I register for push notifications.And not even Failed to register device for push notifications is being printed. Nothing is being printed other than "Register for remote notifications"
Hi hk100!

There are some circumstances in which neither didFailToRegisterForRemoteNotificationsWithError nor didRegisterForRemoteNotificationsWithDeviceToken are called.

If the device cannot communicate with Apple's APNS servers to register the device and get a push token, neither of the callbacks will be called. This can happen if the device has no connectivity or low connectivity, resulting in the request not reaching our servers.

Do you see this issue when the device has connectivity on cellular / the wifi network?
Cordova Plugin Register for Push Notifications
 
 
Q