In ios10 apple introduce UserNotifications framework, Apple has given us the ability to make notifications that contain images, sound, video, or even custom content generated on the device. Much of this capability comes via three new features showcased at WWDC: media attachments, notification service extensions, and notification content extensions.




The UserNotifications framework (UserNotifications.framework) supports the delivery and handling of local and remote notifications. You use the classes of this framework to schedule the delivery of local notifications based on specific conditions, such as time or location. Apps and extensions also use this framework to receive and potentially modify local and remote notifications when they are delivered to the user’s device.


          Triggers a notification at the specified date and time.
          Triggers the delivery of a notification when the user reaches the         specified geographic location.
          Provides the editable content for a notification.
          Contains the data for a delivered notification.
          Defines a task to perform in response to a delivered notification.
          Manages media content associated with a notification.
          Defines the types of notifications your app supports and the custom actions displayed for each type.
          Stores the content of a local or remote notification.
          Encompasses a notification’s content and the condition that triggers its delivery.
          Contains the user’s response to an actionable notification.
          Modifies the content of remote notifications before they are delivered to the user.
          Contains the notification-related settings and authorization status of your app
          Represents a sound to be played when a notification is delivered.
          Provides common behavior for subclasses that trigger the delivery of a notification.
          Indicates that a delivered notification was sent using the Apple Push Notification Service.
          Defines an action that contains user-specified text.
          Contains the user’s response to an actionable notification, including any custom text that the user typed or dictated.
          Triggers the delivery of a local notification after the specified amount of time.
          Manages the notification-related activities for your app or app extension.


Handles notification-related interactions for your app or app extension.


Lets Start

Step 1: Create certificataes with using your developer account and don't forgot to enable push notification services.


Step 2: Create new project

Step 3: Click to Targets then click to general and select team or select valid provisioning profile, make sure your bundle identifies is same with certificate bundle id.

Step 4: Click to capabilities and enable push notification.

Step 5: Open AppDelegate.swift

Step 6: import UserNotifications framework

Step 7: Add UNUserNotificationCenterDelegate in appDelegate class

Step 8: Now register for push notification

// Code

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

//register for push notification


func applicationWillResignActive(application: UIApplication) {

        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

    func applicationDidEnterBackground(application: UIApplication) {

        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

    func applicationWillEnterForeground(application: UIApplication) {

        // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.

    func applicationDidBecomeActive(application: UIApplication) {

        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

    func applicationWillTerminate(application: UIApplication) {

        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.

    func registerForPushNotifications(application: UIApplication) {
        UNUserNotificationCenter.currentNotificationCenter().delegate = self
            UNUserNotificationCenter.currentNotificationCenter().requestAuthorizationWithOptions([.Badge, .Sound, .Alert], completionHandler: {(granted, error) in
                if (granted)
                    //Do stuff if unsuccessful...

    // Push notification delegate
    func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
    func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {

        print("DEVICE TOKEN = \(deviceToken)")
        //let token = JSON(device_token)
        device_token = "\(deviceToken)"
        device_token = device_token.stringByReplacingOccurrencesOfString("<", withString: "")
        device_token = device_token.stringByReplacingOccurrencesOfString(">", withString: "")
        device_token = device_token.stringByReplacingOccurrencesOfString(" ", withString: "")
    func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {


Once you are done with this then trigger push notification via APN Tester

Download APN Tester from here:

Add certificate in APN Tester and hit push button.

and you will get your first push notification