I'd like to use iOS local UNNotifications
even if my app is not running. The same way we use Alarm in Clock app. We can setup Alarm, then quit our Clock app but... sound and notification will run on time. I need the same type of behaviour.
Is it possible?
My code's excerpt:
import UIKit
import UserNotifications
class ViewController: UIViewController, UNUserNotificationCenterDelegate {
override func viewDidLoad() {
super.viewDidLoad()
let content = UNMutableNotificationContent()
content.title = "Our title"
content.body = "A body of message"
UNUserNotificationCenter.current().delegate = self
content.sound = UNNotificationSound.default()
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: false)
let request = UNNotificationRequest(identifier: "testID", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
}
}
Check this Apple Document About 30 seconds
Built-in Clock app made by Apple. have Special treatment (No way)