I want to know how to fire continuous local notification in ios (Swift), I run the local notification code in for loop but, when I terminate the app it will not execute full code.
Asked
Active
Viewed 420 times
1
-
2You can't send local notification when your app is in kill state. – Protocol Nov 23 '21 at 06:40
-
2then how Alarmy app do? – ketan chauhan Nov 23 '21 at 07:04
-
1are you sure they are sending local push notification – Protocol Nov 23 '21 at 10:49
-
1Please have a look to this answer https://stackoverflow.com/questions/17988245/local-notification-on-application-termination – Protocol Nov 23 '21 at 10:51
-
1Please provide enough code so others can better understand or reproduce the problem. – Community Nov 28 '21 at 09:31
1 Answers
1
Try the following:
let content = UNMutableNotificationContent()
content.title = "Hello"
content.body = "World"
content.badge = 1
content.sound = UNNotificationSound.default
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: true)
let request = UNNotificationRequest(identifier: "", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)

Arik Segal
- 2,963
- 2
- 17
- 29