The Problem
Quick googling suggests that, we can get the device token from the app delegate callback method. However this method doesn't work for production apps. So how do we get the device token of a production iOS app?
The Solution
The solution is pretty straightforward and extremely low tech :D. We could get the device token from XCode using the following steps:
- Connect your device with the Mac
- Open XCode, click on Window -> Devices and Simulators
- Devices and Simulator window opens up, click on "Open Console"
- New and shiny device console opens up
- Launch the app and accept the popup to receive notifications.
- Now on the device console search for "Request per-app token with token identifier"
- You should get the device token which is in the format "4D2338E0-1D8F-490A-9C8E-F5A4FEA2CFFF"
Open Devices and Simulators |
Click on Open Console |
Device Console with Push Token |