We have a live app which sends push notifications just fine.
New version of the app, not yet released - we want to test that push notification works, but it seems all we can test is that the service is working. This test version which uses the 'sandbox' doesn't actually send a push to a development phone ....
Is this right? Is there a way I can test this new version of the app AND receive push notifications to my device?
Been trying to crack it for several days now.
Thanks in advance!
Andy
You need distribute the Distribution version of your app using ad hoc.
When your application ready for submission, you create an ad hoc provisioning profile specifying an App ID that matches one or more of your apps, a set of test devices, and a single distribution certificate.
Here is an image to illustrate how the provision profile works:
You need to first test the app in isolation to check that is working, then when it is move on to testing the app and server in combination.
To test your app in isolation run it in Xcode and put in a breakpoint or NSLog to find out what the APN token is.
Then use the php script from here
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
using your APN token and credentials.
It should work, and it should work in the sandbox, if it doesn't then your app isn't correctly configured so work at investigating why it doesn't work until you can send it a push manually.
THen once you can send a push manually test you can send one using your server, if you can't then it must be due to a problem with the server as you have just confirmed the app is working. If the server isn't working its probably not using the credentials or applying the password to the credentials, something like that
Related
I am using onesignal plugin for push notifications in my android and ios app so I want to test push notifications first on development side and then I will upload it on ios app store. Or is there any best practice for implementation of onesignal push notification first for testing and then distribution.
Personal opinion, you do not need separate profiles/certificates for development and production anymore in case of APNs. Recently apple has made some changes. Now you only need one '.p8' push notification certificate from your 'developer.apple.com' account. You give this .p8 file to your backend team.
Xcode will automatically manage your production and development on your side.
This is what you have to do to make it work:
For the backend:
In your app delegate, inside the function where you get APNs token from apple. This APNs token will either be development or production. How does apple decide, which one to give? Well when you export an IPA/App locally, or upload it on test flight or on App store, Xcode will automatically give you production push notification APNs. When you install IPA/App locally using xcode to a phone connected to xcode or on simulator, Xcode will automatically give you development/staing push notification APNs token inside that function. And at that point you just have to send that token to your backend.
How will backend check if the user's token they are getting is production or development?
Using your URL, if it is staging, it will consider it as development APNs token.
If it is production URL, it will consider it as production APNs token.
What you have to make sure?
Make sure the Base URL is set to production if you are uploading app to test flight.
Make sure the Base URL is set to development if you are running app locally on simulator or your phone connected to your xcode.
I am using Firebase server to send Push Notification to Live App Store build. I in following situations:
I was getting notification some period of time and stop from day.
But, i am getting all Push on my iPhone(By App Store Build) but my clients not getting notification.
My Questions:
I got some Push on Device and stop now,Does it mean my .p12 certificates wrong?
2.I think i submitted build to App Store using Ad Hoc Provisioning profile this could cause issue to some devices to stop notification?
My server team using Python language to send Push something use of Lamda causing issue(Server Side)?
Is this DeviceToken/ FCM issue?
5.How to make work the notification to Live App Store build install by customer?
How to fix this? Any help will much much appriciated.
Generate new certificates, add them to firebase, fix them within the app ,submit new build.
1) The push certificate expires after a year. Have you been to the Apple provisioning portal to see if it is still valid? If not, regenerate new ones for use with the server. You do not need to rebuild the app.
2) There is only one type of build provisioning that can be submitted to the App store. You think Apple will not check what is being submitted? You cannot have submitted anything that is not intended to be submitted
3)How can we possibly speculate on your server code. If they changed something on the server then of course they could have broken something. Whats Lamba got to do with anything
4) If the push token becomes invalid and your app does not send the new one to the server then push would not work for whatever devices have stale tokens
5) How can this be answered when you have not yet determined the cause.
If push has suddenly stopped for every device then either the push certificate is invalid or the server code has changed and broken something.
If push has stopped for just some devices then its likely that either your app is not sending a new token to the server when the token changes, or it is but your server is ignoring it and using old tokens.
If push has never ever worked for an app store build (which you are positively sure is an app store build) then either your server is sending pushes on the sandbox environment and not the production environment, or apns is not enabled for production and neither your nor anybody in your company ever tested pushes with a production build and production push environment before submitting to the app store.
I've developed an app with Ionic for Android and iOS devices.
I'm having trouble with the notifications for iOS. In development everything works fine, but in production, when I send the notification, it gets back to me with this error: `
APNS_BAD_DEVICE_TOKEN
The certificates that I've uploaded on ionic.io are the ones generated by distribution, I'm positive about that. APNS certificate such as APP Store one and Provisioning Profile as well.
If I download the app from the Apple Store i get the error I wrote before, and if I create it from Xcode, it works perfectly. Plus it generates two different device tokens (one with the App Store and another one from Xcode).
I've deleted and created the certificates many times, and everything is still working like that. I'm pretty lost here, can anyone help me out?
If you are installing directly to your phone from Xcode, then you have to use Development security profile and make sure you are sending the notification from server side to iOS devlopment sand box. If you are using TestFlight/AppStore you need to use Production profile and make sure you are sending the notification to iOS production sandbox.
I have a Development APNs iOS Certificate for my new app, and from my server I am successfully sending push notifications and receiving them on own iPhone, using the device token. I have a partner in this app development, and I create an .ipa file of the app and give it to him for testing. This is called ad-hoc development. It has worked for us thus far.
From my server it looks like I am successfully sending out the push notification to his device as well as mine, using HIS device token of course (but using the same Dev APNs Cert), but he never receives the notifications. I still continue to receive my notifications. I also have registered his device in my dev center. He does not have a developer account.
So after reading up a little I am thinking that maybe with this APNs Dev certificate it is impossible to send notifications to third party devices, like my partner's device in this case. I was thinking perhaps I need to create a DISTRIBUTION certificate. Is this true? Or should the notifications work for many devices just using the APNs Dev certificate?
Thanks
Pushes go out over two environments - development and production and they are not interchangeable - i.e. if you send out a push to the Apple development server intended for a release build app it won't work and vice versa.
Apps installed and run via Xcode are debug builds and you need to send the push via the dev server, an app built for distribution is a prod build and thus the pushes need to go to the prod server.
As you are probably aware the url for the two servers is different.
Needless to say the server needs to be signed with both the prod and dev push certificates for the server to be able to send pushes on both environment.
BTW the two environments do not behave the same in terms of delivery speed etc. But this is only really noticeable for silent pushes, where bizarrely the dev environment is better than the prod one.
i have used app with ios8.0 SDK and created explicit app id which is enabled push notifications for development environment
I have create provision profile for explicit app id and added profile to Xcode and run the app , then device token is generating, by using NWpusher i have tested notifications. notifications are working fire.
If we build the app and created ipa and installing that ipa on same device, generating different device token, and by using that device token in NWpusher app notifications are not working
Here i have used only developer environment for notifications
You have to repeat the exact same procedure that you undertook for the development certificate and testing in Xcode, once again only now for the production environment.
Getting push notifications to work can be a real pain, thus it is important to take a structured approach. Your issue is actually quite common, people tend to think that once they got push running in dev mode, it'll work in production mode immediately. This is not the case.
I recommend you to go through Ray Wenderlich's Tutorial on Push and take it step by step. They are demonstrating the case with a dev certificate as well, but the in the end they state the following (and this part is very often overread, they should point it out more clearly):
When you are ready to release your app, repeat this process for the
production certificate. The steps are the same.
You need to generate certificate and environment for distribution to work