BE AWARE OF THE BATTERY ISSUE, WHICH BLOCKS YOU FOR ONE DAY OR MORE!
Never start testing pushes in development mode (tethered phone) unless the phone is fully charged.
https://developer.apple.com/library/archive/technotes/tn2265/_index.html
If your notification payload contains the content-available key, your app will receive the notification if iOS or OS X determines it is energy-efficient to do so. If the energy or data budget for the device has been exceeded, your app will not receive any more notifications with the content-available key until the budget has been reset. This occurs once a day and cannot be changed by user or developer action.
In general, notifications (particularly when you are tethered) are flakey regarding battery state of the phone. (Further, some of the stuff mentioned in that article, which is very old, is now plain wrong.) Basically you will often JUST NEVER GET notifications, if your phones enter "don't get notifications because of battery" mode - and it can go on for days.
Notifications do (or did) prefer cellular!!
On iOS, push notifications use the cellular data network whenever possible, even if the device is currently using Wi-Fi for other network activity such as web browsing or email. However, the push service will fall back to Wi-Fi if cellular data service isn't available.
This has changed a lot with different iOS versions but it's a huge hassle.
CRITICAL TIP !!
Don't forget that:
Build to a tethered phone: you will only get the "sandbox, development" push notifications. But
Increase build number, build normally for Test Flight, send to test flight, and then install from Test Flight. You will now get correct normal Apple push notifications.
Very confusingly you !!DO!! get REAL push notifications on development Test Flight builds.
That is to say - when you build to TestFlight you DO GET exactly the same "real" push notifications as for actual apps published on the app store and used by your public users - real, true, APNS push notifications.
The very confusingly-named "development, sandbox" push notifications are ONLY for "tethered phone builds".
(And as mentioned to add more confusion, the "development, sandbox" push notifications often just don't work: although update for 2024 they seem more reliable these days.)
Read more here! https://mcmap.net/q/538629/-ios-push-notifications-using-tls-certificate-vs-using-authentication-tokens