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.

Expired extensions

Expired extensions

From the course: iOS and watchOS App Development: Notifications

Start my 1-month free trial

Expired extensions

- [Instructor] You might be tempted to load an image from a server in a push notification or other content that might take awhile. If you load it within a short window of time, it will load, but it may also timeout. When it times out, it shows the original payload from the server, but you get one last chance before that happens. Find the notificationservice.swift file. And if you go down in there. You can take a look here. You'll see that there's a method called service extension time will expire. And it says here, called just before the extension will be terminated by the system. Here, you've got a very short time to get some content in. It'll generally be just text content. You could, for example, add just above the content handler an extra little bit on the title. So we can put, for example, bestAttemptContent.title = bestAttemptContent.title and we're just going to append onto the end of that Late or something to that effect. Now there's not much to test here. But as part of the…

Contents