Push notifications are one of the most important interaction points of your app with your users. Simply put, a push notification is a way to send any type of data to your user’s app, even if the user isn’t actively using it. The user will normally see the push notification appear as a banner alert on the device, a badge on the app icon and/or a sound. Push notifications are a direct line of communication to your user. You can alert the user of new content, new messages from friends or any other interesting piece of information. Notifications also provide users with a quick way to interact with your app and allow for faster interaction via background data downloads.
Conversely, notifications can be a bane to app retention — meaning how likely a user is to continue using your app – if you send them too frequently or use them in a way that’s not useful to your customers. For example, if you send notifications about app version upgrades or messages just telling them new content is available, that will lead to bad user experiences.
Push notifications may seem simple and straightforward at first because they aren’t hard to use and almost everyone is familiar with them; however, knowing how and when to use them may prove challenging. With advancements in the latest iOS releases bringing some exciting advanced features — such as Rich Media Notifications, Notification Actions, Grouped Notifications and more — you may quickly realize that you need a book to help you out. Well, here’s that book!
In this book, you’ll learn everything you need in order to create, send and receive push notifications, meaning notifications that come from an external service as opposed to locally from the device. You’ll also cover how to handle local notifications because, sometimes, you don’t need all the overhead of a remote notification; rather, it’s enough to simply schedule a notification to appear at a specific point in the future or when you enter a specific location.
Once you’ve worked your way through this book, you’ll be a master of push notifications and well on your way to implementing them inside your own apps!
However, as helpful as this book may be and as great as push notifications can be, it’s critical that you always keep in mind that the user may never receive your notification. Not only can your users opt-out of them at any point in time, there is no guarantee your push notifications will be delivered. What this means, as a developer, is that you can’t depend on push notifications for your app to function properly — but this doesn’t mean your push notifications shouldn’t be well-made and used responsibly, which is what will be covered in this book.
To follow along with the tutorials in this book, you’ll need a Mac computer capable of running Xcode. You can get the latest version of Xcode for free from the Mac App Store (apple.co/1f2E3nY). While there are other platforms for developing iOS apps, none are officially supported by Apple and will not be covered in this book. This book is written with Xcode 12, iOS 14 and Swift 5.
Please note that you’ll need a paid Apple Developer account in order to create a Push Notifications certificate and run any of the apps included in this book. While Apple’s iOS Simulator is now capable of receiving push notifications during development, it is still not capable of receiving remote notifications. If you don’t have a physical device, such as an iPhone or iPad, you won’t be able to work through Chapter 6, “Server-Side Pushes”.
You will also need an intermediate level of knowledge of Swift and iOS development. This book makes the assumption that you are already an experienced iOS developer and are looking for details on implementing push notifications in your apps, or looking for a great reference when working on your app’s notifications.
If you need to brush up on your Swift or iOS skills, you may be interested in the following resources:
- Swift Apprentice (https://bit.ly/2XU2YdR)
- UIKit Apprentice (https://bit.ly/3sE4Khb)
- “Programming in Swift: Fundamentals” video tutorials (https://bit.ly/3kCNapj]
- “Your First iOS and SwiftUI App” video tutorials (https://bit.ly/35RnnFu)
Let’s get started!