Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-6496

Cannot obtain iOS Push token with registerForPushNotifications

    Details

      Description

      SDK 8.3.1

      I was working on an app with push notification using Firebase module.
      Suddenly during testing the Firebase Admin SDK server side, iOS devices stops show notifications.
      So I started investigate, the iPhone got iOS 13.3.1 update but seems to fire the token event correctly.
      I go back to the pure deviceToken generation creating a new app and find out that registerForPushNotifications not even fire a callback!
      This is the only code inside the app

      var deviceToken = null;
      // Wait for user settings to be registered before registering for push notifications
       
       
      // Process incoming push notifications
      function receivePush(e) {
          alert('Received push: ' + JSON.stringify(e));
      }
      // Save the device token for subsequent API calls
      function deviceTokenSuccess(e) {
      	Ti.API.info(JSON.stringify(e));
          deviceToken = e.deviceToken;
      }
       
      function deviceTokenError(e) {
          alert('Failed to register for push notifications! ' + e.error);
      }
      Ti.App.iOS.addEventListener('usernotificationsettings', function registerForPush() {
      	Ti.API.error("registerForPush");
          // Remove event listener once registered for push notifications
          Ti.App.iOS.removeEventListener('usernotificationsettings', registerForPush); 
       
          Ti.Network.registerForPushNotifications({
              success: deviceTokenSuccess,
              error: deviceTokenError,
              callback: receivePush
          });
      });
       
      Ti.App.iOS.registerUserNotificationSettings({
          types: [
              Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT,
              Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND,
              Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE
          ]
      });
      

      Yes the provisioning has the Push Notification enabled.

        Attachments

          Activity

            People

            • Assignee:
              amukherjee Abir Mukherjee
              Reporter:
              Pietro Pietro Granati
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Git Integration