Question

I have azure mobile server and i want push notification using scheduler job, But when i run for testing it fires an error.

Can any one guide me what is problem and solution ?

Shedular Script:

        function push() {                       
            setTimeout(function() {
                push.apns.send("XXXXXXdeviceTokenXXXXX", {
                    alert: "Toast: ", badge: 8            
                },{
                    error : function(err) {
                        console.log('error on 123.');
                    }
                });
            }, 2500);    
        }

ERROR Code:

TypeError: Cannot call method 'send' of undefined at Object._onTimeout (:8:19) [external code]

Was it helpful?

Solution

By defining your function name as push, you're overriding the global push object, which contains the apns member with a send function. Try defining the function in your script with a different name.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top