Closed lucnat closed 8 years ago
Did you ever find a fix for this? I am also running my code in production
just as you are.
I think you have to specify which mode you're using in the developer console for apple?
https://github.com/argon/node-apn/issues/135
I am also having this issue. I think it's worth noting that the following worked for both my production and my development .pem
files.
$ openssl s_client -connect gateway.sandbox.push.apple.com:2195
-cert PushChatCert.pem -key PushChatKey.pem
Enter pass phrase for PushChatKey.pem:
Given that this worked, I am not quite sure why I'm getting:
[123.456.789.012] Push: Sent message "request accepted!" to 1 ios apps and 0 android apps
[123.456.789.012] Got error code 8 for token sakjdgfhasjkdfhasdjkfhsdfhiufhsdjkfahsdjkfhsdjfjasdhfkajasdkjfh=
@LucNaterop I'm actually also having this issue in development.
That's strange. You said it was working fine in development? What did your config and env look like?
Thanks
Got this working -- XCode's provisioning profiles and certificates is one giant spaghetti dinner. Still no luck on the production settings, though :(
@Streemo Production certificates will not work if the app was installed via XCode. Thus, if you installed your app via XCode on your device and use production settings, you will get error code 8 (given your certificates are fine). So how can we test production settings before submitting the app to the store? Via Testflight (Apples platform for beta testing). If you install your app via Testflight (you need to upload an archive to itunesconnect for that and configure Testflight) then it will work with production certificates. Good luck!
@LucNaterop I see, yeah I was going to try an ad-hoc build or testflight. Thanks! When it comes to xcode, I'm gonna need all the luck I can get...
@LucNaterop your suggestion worked :) If using production set to true, we need to build the meteor app, archive the resultant xcode project with the appropriate code signing and provisioning profile keys (etc.), validate it, submit it to the app store, and then use iTunes Connect to modify the meta-data, create testflight users, and start a testflight build. Doing all of the above allowed me to use push notifications (APN) as expected. Thanks for your help!!
@phamduc0810 For IOS you can only test push notifications once the build is uploaded to itunes connect. Upload app with Xcode and install with test flight..
@phamduc0810 That is an error trying to test push notifications in a dev environment
I really need help. Everything else seems to be working except push notifications for IOS. been stuck at this for months now. I'm certain that im using the right certificates and keys but I still get error code 8
@lokiribeiro how are you testing ios?
I tried testing in xcode dev with development certificates and also in testflight with production certificates, signing profiles and environment set to production. Both gives error code 8
To test ios, you have to build, then do in flight testing.. (iTunes connect). Dev certs should work. but unless you download the app through the in-flight testing, it wont work on ios .
So I should be able to receive push notifications with dev cert as long as Xcode installs it on the test device right? and not from test flight.
No, I mean no certs will work unless the app is installed from the store. Inflight testing also installs from the store Did you try https://github.com/raix/push/wiki/raix:push-Newbie-Manual If so your certs are probably correct.
Alright, thanks. I'll try this out
Have you upload the ios build to the store?
yes. it's both in testflight and in official app store now. Sidenote: no need to include gateway: 'gateway.push.apple.com' ?
I got this for both certs: SSL-Session: Protocol : TLSv1.2 Cipher : DES-CBC3-SHA Session-ID: Session-ID-ctx: Master-Key: 265A2E3675EAEB3D2B5B9A65F39B6202A7314411B2099A698BB5E24E276E83ED1D9E288ECC37D5A1B63538DC21C5CCBB Start Time: 1580876489 Timeout : 7200 (sec) Verify return code: 0 (ok)
Good your certs appear good. In Xcode, just put the device on generic ios device, Xcode -> Product -> Archive or use the transporter then on Itunes connect, click the app, then TestFlight section. https://reinteractive.com/posts/344-how-to-upload-your-ios-app-to-testflight-for-distribution-beta
Here's my signing & capabilities settings:
Here's my profile before uploading to appstore:
and here's my config: Push.Configure({ // Google Cloud Messaging apn: { certData: Assets.getText('cert.pem'), keyData: Assets.getText('key.pem'), passphrase: '*', gateway: 'gateway.push.apple.com' }, gcm: { projectNumber: ***, apiKey:"" }, production: true });
and here's how I deploy my app to production in server: sudo MONGO_URL=mongodb://* ROOT_URL=http://*** PORT= NODE_ENV=production METEOR_SETTINGS='{"AWSAccessKeyId" : "**","AWSSecretAccessKey" : "**","SENDGRID_API_KEY" : ""}' pm2 start main.js --name main
looks fine. just upload it to the store. Once uploaded, inside itunes connect just use the testflight section and submit the build. You will need to add testers.
I did everything and still get this error: Push: Send message "Engineer on watch" via query { userId: 'kL2QqFdDTHfQsQbTH' } send to token { apn: 'cYgRvgvJrl0:APA91bHAk2s8q3e9o5Aemh02Bv2KsUVSX3Ipe36pGSwz3dfQOq-K4nXtbJs9Qp4dRVe1kwP83ngCLQUZAnnJ0fzsIl3sfIpwesQHJwh6Z8gYBDU2yFpvESsRmHoXY75ytcHjCzpmsZ0_' } Push: Sent message "Engineer on watch" to 1 ios apps 0 android apps Push, GUIDE: The "Push.appCollection" - No GCM clients have registred on the server yet... Got error code 8 for token cYgRvgvJrl0:APA91bHAk2s8q3e9o5Aemh02Bv2KsUVSX3Ipe36pGSwz3dfQOq-K4nXtbJs9Qp4dRVe1kwP83ngCLQUZAnnJ0fzsIl3sfIpwesQHJwh6Z8gYBDU2yFpvESsRmHoXY75ytcHjCzpmsZ0
At this point I really don't know what seem to be wrong.
This was the log from the server after trying to send a push notification to my testflight app.
so you installed the app from the store?
from the testflight app, I added myself as a tester
I've exhausted every option. I'm thinking if there's any luck by using p8 files instead?
I receive notifications when I fire them from Firebase console cloud messaging using the p8 file I got from Apple Developer Site
are you using the production mode?
yes try p8 files
how do I know if im using production mode?
also is there any documentation for using p8 files? I can't seem to find it in the readMe file here. Thank you
on server: Push.Configure({ apn: { certData: Assets.getText('apnDevCert.pem'), keyData: Assets.getText('apnDevKey.pem'), passphrase: 'xxxxxxxxx', production: true, //gateway: 'gateway.push.apple.com', }, gcm: { apiKey: 'xxxxxxx', // GCM/FCM server key } // production: true, // 'sound' true, // 'badge' true, // 'alert' true, // 'vibrate' true, // 'sendInterval': 15000, Configurable interval between sending // 'sendBatchSize': 1, Configurable number of notifications to send per batch // 'keepNotifications': false, // });
try to the production certs
Is there any documentation too about using p8 files in raix:push?
Delete your collections in the apptokens database. then open the ios app to see if the token registers we want to make sure your not using an old token when the device wasn't installed with testflight.
Yup, I did that too earlier. I deleted all the app tokens and opened my app. The tokens do register.
oh, so the new token from the testflight app is not registering?
They register correctly in the apptokens database
so before you installed the testflight app you cleared the collection correct?
yes correct.
so how did you install the app?
I redeemed it from the testflight app installed on the device.
I just noticed that my Push.Configure block is inside the client/api folder. Maybe that's causing the error? I transferred it to server side now and rebuild.
no you need the push on both client and server client: Push.Configure({ android: { senderID: 12341234, alert: true, badge: true, sound: true, vibrate: true, clearNotifications: true // icon: '', // iconColor: '' }, ios: { alert: true, badge: true, sound: true } });
server: Push.Configure({ apn: { certData: Assets.getText('apnDevCert.pem'), keyData: Assets.getText('apnDevKey.pem'), passphrase: 'xxxxxxxxx', production: true, //gateway: 'gateway.push.apple.com', }, gcm: { apiKey: 'xxxxxxx', // GCM/FCM server key } // production: true, // 'sound' true, // 'badge' true, // 'alert' true, // 'vibrate' true, // 'sendInterval': 15000, Configurable interval between sending // 'sendBatchSize': 1, Configurable number of notifications to send per batch // 'keepNotifications': false, // });
so your server end has the credentials & certs the client just makes sure the token registers correctly
I got both client and server blocks on my mainstartup.js file earlier. Now I transferred the latter to my server side scripts.
It's weird cause it worked with notifications for android even though both are in mainstartus.js
Did it work?
I'll let you know. I'm rebuilding it atm and will deploy the new build to the production server
I am in the process of deploying my app to the app store. I have tested all certicates and keys (development and production) and they are fine. Push works perfectly in development. However, when I set NODE_ENV to production and also "production": true in config.push.json, it won't work anymore. Upon sending a push notification, I get the following error:
I can imagine that this happens because the app has been installed via xcode on the device. Can anybody confirm? Will the message disappear once the app has been installed through the app store? And what is the correct push setting to use with Apple TestFlight?