How to implement push notification for iOS 10[Objective C]? How to implement push notification for iOS 10[Objective C]? ios ios

How to implement push notification for iOS 10[Objective C]?


Sorry guys, I got the answer.I just needed to import UserNotifications framework.

#import <UserNotifications/UserNotifications.h>


Check this

#import <UserNotifications/UserNotifications.h>

Then

    if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) {        UIUserNotificationType allNotificationTypes =        (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);        UIUserNotificationSettings *settings =        [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];        [application registerUserNotificationSettings:settings];    } else {        // iOS 10 or later#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0        // For iOS 10 display notification (sent via APNS)        [UNUserNotificationCenter currentNotificationCenter].delegate = self;        UNAuthorizationOptions authOptions =        UNAuthorizationOptionAlert        | UNAuthorizationOptionSound        | UNAuthorizationOptionBadge;        [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions completionHandler:^(BOOL granted, NSError * _Nullable error) {        }];#endif    }