Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

push.on('registration', callback) not firing iOS #760

Closed
Zaeembinrehman opened this issue Mar 29, 2016 · 5 comments
Closed

push.on('registration', callback) not firing iOS #760

Zaeembinrehman opened this issue Mar 29, 2016 · 5 comments

Comments

@Zaeembinrehman
Copy link

Hi,

The push.on('registration', callback) event is not getting fired on iOS. Any suggestions. Here is the snippet of the code:

function push_notifications(){
    alert('iOS push notification');
    // push notifications methods
    var push_notification = PushNotification.init({
      android: {
        senderID: "xxxxxxxxxxxx",
        sound: true,
        vibrate: true
      },
      ios: {
        alert: "true",
        badge: "true",
        sound: "true"
      },
      windows: {}
    });

    push_notification.on('registration', function(data) {
      alert('on registration event fired');  
    });

    push_notification.on('notification', function(data) {
      alert('iOS on notification');
      // alert(data.message);
      // data.message,
      // data.title,
      // data.count,
      // data.sound,
      // data.image,
      // data.additionalData
    });


    push_notification.unregister(function() {
      alert('success in unregister');
    }, function() {
      alert('error in unregister');
    });


    push_notification.on('error', function(e) {
      alert(e.message);
      console.log(e.message);
    });

  }
@macdonst
Copy link
Member

@Zaeembinrehman this sure looks like a duplicate of #752.

Stop calling the unregister function after the init function.

@Zaeembinrehman
Copy link
Author

@macdonst

I just changed the flow for unregister, and still not getting the registration event fired.

I created a new provision (APNs enabled) and generated the build again through the build server.

Using:

  • Windows 8
  • Phonegap Version: cli-5.2.0
  • iOS Phonegap Version: 3.9.1

@mayur8188
Copy link

same issue with me also.

@Zaeembinrehman
Copy link
Author

@mayur8188 , if you are using adobe cloud build and your iOS building version is 3.9.1 then try setting the an attribut in the config file for your push plugin as:

the latest version of push plugin doesn't work with iOS building version is 3.9.1

Hope that helps!

@lock
Copy link

lock bot commented Jun 4, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants