Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-25793

iOS: No callback when not granting push notification permission (Apple bug)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: None
    • Resolution: Done
    • Affects Version/s: Release 7.0.2
    • Fix Version/s: None
    • Component/s: iOS
    • Environment:
    • Story Points:
      5
    • Sprint:
      2018 Sprint 11 SDK, 2018 Sprint 12 SDK

      Description

      Hi,

      I am trying to enable push notifications on IOS device and when I grab token I am being asked to provide push notification permission. If I choose not to give it, error callback is not thrown. I copied code directly from Push Notifications Reference Guide:

      http://docs.appcelerator.com/platform/latest/#!/guide/Subscribing_to_push_notifications

      Here is the code:
      ---------------------------------------------------------------------------------------------------------------------------------------------------

      var deviceToken = null; 
       
      // Check if the device is running iOS 8 or later 
      if (Ti.Platform.name == "iPhone OS" && parseInt(Ti.Platform.version.split(".")[0]) >= 8) { 
       
      // Wait for user settings to be registered before registering for push notifications 
      Ti.App.iOS.addEventListener('usernotificationsettings', function registerForPush() { 
       
      // Remove event listener once registered for push notifications 
      Ti.App.iOS.removeEventListener('usernotificationsettings', registerForPush); 
       
      Ti.Network.registerForPushNotifications({ 
      success: deviceTokenSuccess, 
      error: deviceTokenError, 
      callback: receivePush 
      }); 
      }); 
       
      // Register notification types to use 
      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 
      ] 
      }); 
      } 
       
      // For iOS 7 and earlier 
      else { 
       
      Ti.Network.registerForPushNotifications({ 
      // Specifies which notifications to receive 
      types: [ 
      Ti.Network.NOTIFICATION_TYPE_BADGE, 
      Ti.Network.NOTIFICATION_TYPE_ALERT, 
      Ti.Network.NOTIFICATION_TYPE_SOUND 
      ], 
      success: deviceTokenSuccess, 
      error: deviceTokenError, 
      callback: receivePush 
      }); 
      } 
       
      // Process incoming push notifications 
      function receivePush(e) { 
      alert('Received push: ' + JSON.stringify(e)); 
      } 
      // Save the device token for subsequent API calls 
      function deviceTokenSuccess(e) { 
      deviceToken = e.deviceToken; 
      } 
       
      function deviceTokenError(e) { 
      alert('Failed to register for push notifications! ' + e.error); //this is the function that never gets thrown. 
      } 
      

      ---------------------------------------------------------------------------------------------------------------------------------------------------

      Note that deviceTokenError never gets thrown once permission has been granted/revoked.

      Expected Result: error callback should be fired when not granting push notification permission.
      Actual Result: error callback never be fired.

      Thanks

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hknoechel Hans Knöchel
                Reporter:
                morahman Motiur Rahman
              • Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-6194
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code