Errata for Push Notifications by Tutorials, 3rd ed

Creating this topic to catch any typos and bugs in the 3rd Edition of Push Notifications by Tutorials.

1 Like

Really looking forward to this! do you have an ETA?

If I said anything other than “very very soon” @mandafrederick would hunt me down and hurt me, so…very very soon :]

1 Like

I found an error in the example code.

Chapter 7: Expanding the Application
See AppDelegate.swift in the Sending the token section.

guard let url = URL(string: "http://192.168.1.1:8080/api/token") else {
  fatalError("Invalid URL string")
}

I think it should be fixed as follows.

guard let url = URL(string: "http://192.168.1.1:8080/token") else {
  fatalError("Invalid URL string")
}

The code in the book (I think that’s what you’re referring to) is correct. In Chapter 6, when creating the TokenController, you setup the routes like so:

func boot(router: Router) throws {
  let routes = router.grouped("api", "token")
  routes.post(Token.self, use: storeToken)
  routes.delete(String.parameter, use: removeToken)
}

meaning you POST to …/api/token

I think I found a typo.
In Ch8.2 Tapping the notification, “Then, set the property inside userNotificationCenter(:willPresent:withCompletionHandler) by replacing the // Perform actions here comment with the following code" "userNotificationCenter(:willPresent:withCompletionHandler)” I think it should be “userNotificationCenter(_:didReceive:withCompletionHandler:)”

You’re correct, thanks. I’ve fixed the text for the next release.