havesource / cordova-plugin-push

Register and receive push notifications
MIT License
148 stars 283 forks source link

PushNotification .on('registration', function(data) {} on ios with APNS is not executed! #202

Open xandervisma opened 1 year ago

xandervisma commented 1 year ago

Bug Report

Hi, Previously we always used the cordova-plugin-push but because it is deprecated we switched to havesource/cordova-plugin-push. On android with GCM it works perfectly. But on ios with APNS the push.on('registration', function(data) {} is not fired/triggerd/executed. Please help me out!

Expected Behaviour

push.on('registration', function(data) {} needs to fired/triggerd/executed

Actual Behaviour

push.on('registration', function(data) {} is not fired/triggerd/executed.

Reproduce Scenario (including but not limited to) / ### Steps to Reproduce

Install cordova project with this plugin and use the APNS way. The APNS is used when there is no google plist file in your config or root folder. Put a Alert or Console.log in the push.on('registration', function(data) {} and test it.

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iphone simulator with iOS 14 or higher

Sample Code that illustrates the problem

` var push = PushNotification.init({ android: { senderID: "", icon: "push", iconColor: "blue", forceShow: true, soundname: "mysound", sound: "true" }, browser: { pushServiceURL: 'http://push.api.phonegap.com/v1/push' }, ios: { alert: "true", badge: "true", clearBadge: "true", soundname: "mysound", sound: "true" }, windows: {} });

        push.on("registration", function(data) {
            alert(data);

            window.registrationId=data.registrationId;
        });

});

`

Thank you very much!

Kind regards,

Xander

GexxOn commented 1 year ago

adding FirebaseAppDelegateProxyEnabled to NO in my info.plist file did the trick https://stackoverflow.com/a/51518574/3730949

xandervisma commented 1 year ago

Thank you very much! My team and I are going to try this out.

GexxOn commented 1 year ago

i also noticed 'registration' is not called within the simulator - so you have to plug in your device you will see the Push Plugin register success: {length = 32 ... msg in your console

geoidesic commented 1 month ago

I'm having the same issue but Info.plist is no longer a thing in Xcode 15.4 and I can't find that setting anywhere.

maxs15 commented 1 month ago

@geoidesic, check the pull request (#283 ) I just published. It might help you.