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.
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.
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?
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.
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.
@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 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.
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?
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.
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.
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.