Netbeans Cordova PushPlugin not working on iOS -
i'm building cordova project netbeans, uses pushplugin (https://github.com/phonegap-build/pushplugin).
it works great on android, on ios doesn't register device. doesn't give errors.
what's strange plugin folder (com.phonegap.plugins.pushplugin) in projects /plugins folder, it's not being copied platforms/ios/[appname]/plugins on build.
i have in config.xml:
<feature name="pushplugin"> <param name="android-package" value="com.plugin.gcm.pushplugin"/> <param name="ios-package" value="pushplugin"/> </feature>
and work following javascript:
var pushnotification; function ondeviceready() { alert('ready'); try { pushnotification = window.plugins.pushnotification; if (typeof device == 'undefined') { alert('device undefined'); } if (device.platform == 'android' || device.platform == 'android' || device.platform == 'amazon-fireos') { pushnotification.register(successhandler, errorhandler, { "senderid": "[senderid]", "ecb": "onnotification" }); } else { alert('ios!'); pushnotification.register(tokenhandler, errorhandler, { "badge": "true", "sound": "true", "alert": "true", "ecb": "onnotificationapn" }); } } catch (err) { txt = "there error on page.\n\n"; txt += "error description: " + err.message + "\n\n"; alert(txt); } } function onnotificationapn(e) { // handles apns notifications ios if (e.alert) { navigator.notification.alert(e.alert); } if (e.sound) { var snd = new media(e.sound); snd.play(); } if (e.badge) { pushnotification.setapplicationiconbadgenumber(successhandler, e.badge); } } function onnotification(e) { //handles notifications android (left out) } function tokenhandler(result) { alert('device token = ' + result); } function successhandler(result) { alert('success = ' + result); } function errorhandler(error) { alert('error = ' + error); } document.addeventlistener('deviceready', ondeviceready, false);
i see 'ready' , 'ios!' alerts, after that, nothing happens.
problem solved! turns out had copy plugin files , manually add them xcode project.
Comments
Post a Comment