Kodeco Forums

iOS 10 Screencast: The UserNotifications Framework

iOS 10 combines the presentation of notifications to users from both local and remote sources into a simple, cross-platform new framework. In this screencast you'll see how easy it is to send local user notifications with the new UserNotifications framework - a great place to start upgrading your apps to iOS 10.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4997-ios-10-the-usernotifications-framework

Small question: Is Notification service extension works even if app is killed from app switcher?
I still haven’t time to try it, and that’s why I’m asking.

Awesome, thanks for the early preview.

1 Like

The more interesting and more commonly used is remote notifications. Will you be showing that soon?

Subtitles please! :wink:

I haven’t actually tested this, but I’m fairly sure that it does work even after the app has been killed. I seem to remember a change in policy on using extensions once the app has been killed in a recent (maybe iOS 9) release?

@gargoyle

The beauty of the UserNotifications framework is that it pretty much consolidates both local and remote notifications. This video demonstrates the changes relating to the scheduling of local notifications. The most interesting aspect of remote notifications wrt the UserNotifications framework is the new Service Extension point, which will indeed be covered in an upcoming screencast.

@smashkins

Strange that the subtitles aren’t there - the video definitely has them. I’ll see if we can get that fixed.

1 Like

I’ve not been able to find anything in the new framework though that tells me I have in fact registered for remote notifications and what my APNS token is when I’ve registered.

The handling of registration for remote notifications is all that remains on the application and app delegate. The handling of notifications, and scheduling of local notifications is now all on the UserNotifications framework.

@smashkins Thanks for bringing this to our attention! Subtitles are now fixed. :]

To view or hide them, click the CC button at the bottom of the video viewer.

1 Like

Can be used targeting iOS 9 Apps? Or just only iOS 10.

@ivangodfather

It’s a new framework in iOS 10 - so no iOS 9 I’m afraid :frowning:

@samdavies , Thanks for a wonderful video tutorial and giving us a peek into IOS 10 notifications.

What is the version of XCode used here? I downloaded the project and opened in XCode Version 8 - Beta 6 and the downloaded version got many compile errors.

Thanks in advance for your inputs.

Hi @pinal,

Thanks for your nice comments. I think that this video uses Xcode 8β2, so there will be some changes compared to the GM, particularly surrounding Swift.

The iOS 10 by Tutorials book chapters and sample code will be up to date when the book is released in the next few weeks, so I suggest you take a look at that code to see how it needs to be updated.

sam

1 Like

@samdavies, thanks a bunch for your inputs !!

1 Like

Hi Sam,

Thanks for great tutorials! I am generating notifications from cloudkit subscriptions and I am trying to change its content before showing it to user, is it possible?

Thanks!

Hi @harsh08

I’m not sure… I don’t know a whole lot about CloudKit subscriptions. I know they use APNS, so the notification should pass through the notification extension, but I don’t know anything about what they display.

Sorry!

sam

Hi, Thanks for the good tutorial. One question: is it possible to play a long sound file(about 20-25sec) with banner notification? I mean have the file be played completely, assuming we get the user’s permission on the first run.

@alitorabi

I’m not sure what the maximum length of alert sound that you’re allowed to use with a notification. I’m guessing that you’ve tried this and discovered that it gets cut off?

If this is the case, then I’m not sure what you could do - I don’t think that there’s an answer. If you want to play the entire audio file, then you could provide it as a media attachment to the notification, or provide a custom notification UI, which provides a player. But this would only work when the user 3D Touches, or drags the banner down.

Hope that is of some help!

sam