0 Replies
      Latest reply on Mar 16, 2020 11:48 PM by Ravi Malviya Panamax
      Ravi Malviya Panamax Level 1 Level 1 (0 points)

        I had integrated VoIP and remote notification in my app, but Specifically, in iPhone 5s with ios 12.4.5. I did get a VoIP token or remote token.

        UIApplicationDelegate's toke method and PKPushRegistryDelegate's token method not invoke. what's wrong here

        I already tried with a strong network of cellular instead of connecting with wifi.

        Please help me with this issue.

         

        here is my code

        @interface AppDelegate : UIResponder <UIApplicationDelegate,PKPushRegistryDelegate,UNUserNotificationCenterDelegate>

        {

             PKPushRegistry *voipRegistry;

        }

        @implementation AppDelegate


        - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
        {
          [self pushNotificationRegister];
          return true;
        }

         

        -(void)pushNotificationRegister

        {

                UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];

                UNAuthorizationOptions options = UNAuthorizationOptionAlert + UNAuthorizationOptionSound + UNAuthorizationOptionBadge;

                center.delegate = self;

                [center requestAuthorizationWithOptions:options completionHandler:^(BOOL granted, NSError * _Nullable error){

                    if( !error ){

                        dispatch_async(dispatch_get_main_queue(), ^{

                            [self voipRegistration];

                            [UIApplication.sharedApplication registerForRemoteNotifications];

                        });

                    }

                }];

                [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {

                    if (settings.authorizationStatus != UNAuthorizationStatusAuthorized) {

                    }

                }];

        }

         

        - (void) voipRegistration

        {

            voipRegistry = [[PKPushRegistry alloc] initWithQueue: dispatch_get_main_queue()];

            voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];

            voipRegistry.delegate = self;

        }

         

        - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

        {

             // Not invoke

        }

        - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error

        {

             // Not invoke

        }

        - (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)pushCredentials forType:(PKPushType)type

        {

             // Not invoke

        }

        - (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(PKPushType)type

        {

             // Not invoke

        }

        - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler

        {

            completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound);

        }

        - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler

        {

            completionHandler();

        }

        @end