Local Notifications with iOS 10?

0 votes
asked Apr 28 by admin (8,115 points)

Hi All

  iOS 10 Apple has deprecated UILocalNotification which means it is time to get familiar with a new notifications framework. Can any one give sample code for this

1 Answer

0 votes
answered Apr 28 by anonymous
Hi Try this below code

import UserNotifications

func scheduleLocal() {
    let center = UNUserNotificationCenter.current()
            let content = UNMutableNotificationContent()
            content.body = “Local Notification“
            content.sound = UNNotificationSound.default()
            let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1,repeats: false)
            let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)