I am maintaining a Node.js application and new to Node.js. This application sends push notifications to ios devices.
For this purpose there is a config file that contains the apn settings ;
apnConfig: {
providerOptions: {
token: {
key: path.join(__dirname, 'keys', 'xxx.p8'),
keyId: 'XXXXXX',
teamId: 'XXXX'
},
production: true
}
And this is where I read the config file;
var provider = new apn.Provider(conf.apnConfig.providerOptions);
I have a .p8 key file for communicate server with APNs. Apple says "You can use this key for both development and production".
My problem is that notifications can not be sent to development devices. In the production environment there is no problem. Notifications can be sent to production devices
I want to send notification both of the devices. Technically there must be no problem with a single .p8 key files .
It writes production: true
in the config file. Does it cause the problem ?
Can you help please ? Thanks
You need to have two different tokens to be able to send to production and development device. My advice would be for you to save somewhere with your device token, if it's a prod device or a dev device, so you know which token you can use.
Hope it helped you!