In a sandbox environment, we can print device tokens to the console for device tokens. But the replacement to the production environment (production) is not so convenient. If you want to get device tokens for your production environment, you can follow these steps:
- Open the following url:http://developer.apple.com/library/ios/#technotes/tn2265/_index.html
- In the upper right corner of the page, there is a Companion file connection, click to download the Companion file. Get a tn2265_persistentconnectionlogging.zip file after downloading.
- Unzip to get a persistentconnectionlogging.mobileconfig file. Send it as an attachment to your own mailbox.
- On the device, use the system's "mail" program to open this message (note that it must be the system's mail program, not the "Mailbox Master" and other third-party mail clients).
- Click on the persistentconnectionlogging.mobileconfig file in the attachment, which will install a APS/PC Logging profile on the device. During the installation process, you will need to enter the lock screen password.
- After installation, restart the device.
- In Xcode, open window/devices, and look at the console log for your device, and you can see similar handlereceivedpublictoken:<282aae5d 52978299 134078ed 2702ea16 ddfbd208 10d6fb01 9353c601 4ad773e4>, this is the device token (remove the space).
How do I get Device tokens for a production environment?