Sending local notifications after the app has been terminated
I am making an app in iOS where it will send local notifications on a timer. It works fine when the app is in background state, but does not work when it has been terminated and closed completely.
Is there anyway to still send local notifications when this has happened?
Thanks in advance.
3 Solutions Collect From Internet About “Sending local notifications after the app has been terminated”
Sure it is possible, if you schedule a local notification it will fire even if you terminate the app.
UILocalNotification *_localNotification = [[UILocalNotification alloc] init]; _localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:_value]; _localNotification.timeZone = [NSTimeZone defaultTimeZone]; _localNotification.alertBody = @"Beep... Beep... Beep..."; _localNotification.soundName = UILocalNotificationDefaultSoundName; [[UIApplication sharedApplication]scheduleLocalNotification:_localNotification];
… works like a charm for me.
The local notification can be delivered when the app is terminated or closed, but they must be scheduled when the app is running. You can set the
fireDate for a notification in the future, schedule it, and it will be delivered whether or not the app is running.
No, it is not possible.
For more info, please visit Local notification on application termination
Hope this helps.
- Swift array cannot be downcast to array of derived
- Setting up AVSynchonizedLayer
- MDM: ssl issue for server url
- How to create own mask in ios
- Return Type of -application:didFinishLaunchingWithOptions:
- Check if string contains special characters in Swift
- Select statement in SQLite recognizing row number
- In xcode 6.1, interface builder deleting ui elements
- UITableview with more than One Custom Cells with Swift
- localizedCaseInsensitiveContainsString not available in Swift
- Sending an automatic Email with Swift and Xcode 6
- How to create image slider in iOS?
- iOS UIImage storage formats, memory usage and encoding / decoding
- Swift 4 Codable decoding json
- Two views, one below another in portrait and side by side in landscape using layout constraints