Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23533] If you have LiveView enabled, then you cannot registerForPushNotifications on iOS

GitHub Issuen/a
TypeBug
PriorityHigh
StatusResolved
ResolutionCannot Reproduce
Resolution Date2017-04-21T04:07:08.000+0000
Affected Version/sRelease 4.0.0
Fix Version/sBacklog
ComponentsiOS, LiveView
Labelsqe-4.0.0, user_experience
ReporterWilson Luu
AssigneeEric Wieber
Created2015-05-08T22:50:05.000+0000
Updated2017-04-23T21:46:01.000+0000

Description

*Details:* If you have LiveView enabled, then you cannot registerForPushNotifications on iOS. *Note:* To workaround this issue, turn off LiveView. *Steps to reproduce:*

Make sure you have a valid provisioning profile for iOS push

Create a Titanium app with services enabled

On platform.appcelerator.com, make sure to setup iOS push

Next, download, unzip, and copy contents of Archive.zip into Titanium Resources directory

Enable LiveView

Install app to device

Once the app is launched, go to *Push Notifications > Settings for This Device*

Click the *Disabled* button to *Enable* push notification

*Actual:* Device token is not retrieved i.e. Ti.Network.registerForPushNotifications is not registering the success callback; go to Resources/windows/pushNotifications/pushManager.js and see line 76. *Expected:* Device token should be retrieved from ACS; see attachment.

Attachments

FileDateSize
Archive.zip2015-05-08T22:47:09.000+00008752
Screen Shot 2015-05-08 at 3.35.26 PM.png2015-05-08T22:46:58.000+0000150059

Comments

  1. Bert Grantges 2015-05-08

    If for whatever reason this is not fixable - we should provide some messaging to the developer if at all possible that they are trying to register push notifications with liveView enabled and there is a known conflict.
  2. Vijay Singh 2017-04-07

    Simple Use case :
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       win.open();
       Ti.App.iOS.addEventListener('usernotificationsettings', e = function(v) {
                       
           console.log("In usernotificationsettings: " + JSON.stringify(v));
           
           Ti.App.iOS.removeEventListener('usernotificationsettings', e);
           Ti.Network.registerForPushNotifications({
               success: onSuccess,
               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
           ]
       });
        
       var onSuccess = function(e) {
                   
           Ti.API.info("TOKEN: " + e.deviceToken);
           alert('Device token is retrieved: ' + e.deviceToken);
           
           // do stuff
       };
        
       var receivePush = function(e) {
           Ti.API.info('Received push: ' + JSON.stringify(e));
       };
        
       var deviceTokenError = function(e) {
           Ti.API.info('Failed to register for push notifications! ' + e.error);
       };
       
  3. Vijay Singh 2017-04-07

    I verified on 6.1.0 and 6.2.0 , it is working fine. It is not working before 6.1.0. [~ewieber] Can you please verify and close it.

JSON Source