From the course: iOS and watchOS App Development: Notifications

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Get the token

Get the token

From the course: iOS and watchOS App Development: Notifications

Start my 1-month free trial

Get the token

- [Instructor] To use a remote notification provider, you need a certificate and a token. The app generates the token with information about the device running the application. It asks APNS some questions and APNS returns the token. Back in Xcode, we stubbed a method earlier that gives us that token. The deviceToken is of type Data. Online test platforms, like we will be using, want a string. You'll need to convert this to a string of eight-bit hexadecimal numbers. Now, I saved you some time here, and I wrote a little function down here called tokenString that does this conversion. This converts the data into a usable token string. If working with unsigned integers is unfamiliar to you, check out the iOS Development Weekly Tip on unsigned integers for more explanation. Let's go back to that TODO, and I can add this right in here by just printing it to the console, tokenString deviceToken. In our exercises, I'm cutting and pasting this into a website, so sending it to the console is…

Contents