Issue
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.
Solution
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 AppStore, 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/staging 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.
Answered By - rana5ohaib
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.