Implementing PushPlugin for iOS with Phonegap
-
22-12-2019 - |
Question
I'm working on implementing push notifications in my Phonegap
iOS application, and a few things are a bit confusing.
First, i'm following this tutorial here: http://devgirl.org/2012/10/19/tutorial-apple-push-notifications-with-phonegap-part-1/
Her tutorials tend to be straightforward, but in one step, she mentions looking under the resources folder and accessing the "Cordova.plist
" file, adding something under the Plugin Key.
As I am unable to do this step, the next step (involving modification of the AppDelegate.m
file) produces multiple errors that I feel might be connected to this. I understand from reading the comments on her tutorial and doing some research that after version 2.5 or so of Cordova
, there is no longer a Cordova.plist
file, and it instead has been converted to the config.xml
file only.
My config.xml file has this feature added:
<feature name="PushPlugin">
<param name="ios-package" value="PushPlugin" />
</feature>
Is there some other place that I might be able to add the plugin key and value since I don't have a Cordova.plist file? I'm pretty new to Xcode and Objective-C, so any suggestions or explanations are greatly appreciated. Thank you!
Solution
The tutorial you are following is some what out of date.
I would suggest using this plugin:
https://github.com/phonegap-build/PushPlugin
This plugin is very well documented and supports automatic installation via plugman. Manually installing a push notification plugin for iOS is very complicated and a nightmare to maintain if you need to scrap your project.
Take a look at the documentation and get yourself familiar with plugman before using the plugin linked above.
All that is required to install the plugin is this following command:
cordova plugin add https://github.com/phonegap-build/PushPlugin.git
You then must write a few JavaScript functions to interface with the plugin, it is all very clearly documented in the readme.MD.