How to repeat local notifications on specific days of the week (iOS Swift 3)
I am creating my first app that lets the user set alerts for themselves and then the app would send the user a local notification on the set time. The thing that I’m having trouble with now is being able to fire the local notification on specific days of the week (for example every Mondays and Tuesdays only). All the tutorials/questions that I have come across so far (like this one) have only been about scheduling the notification everyday/everyweek. The desired result that I’m trying to achieve is sort of like the iPhone’s built in alarm system, where you can set an alarm to fire only on certain days of the week.
If I can’t just set the
notification.repeatInterval field, is there a way I can do what I’m trying to do? Could I possibly execute a little code at midnight that schedules the correct notifications for that day? If so, how could I do that?
Thanks in advance!
- How to have accessible swipe action for iCarousel
- How to clean the content of UIWebView without loading an empty page?
- Removing a view controller from memory when instantiating a new view controller
- AFNetworking fails to download large files
- ffmpeg use on iOS
- Smooth Transition with UIPageViewController and UISegmentedControl like in Apple Music App
Solutions Collect From Internet About “How to repeat local notifications on specific days of the week (iOS Swift 3)”
The thing that I’m having trouble with now is being able to fire the local notification on specific days of the week
In iOS 10, a UNCalendarNotificationTrigger is formed using DateComponents. This means you can specify as much or as little of the date-time in question as you wish. Thus, if you specify a specific weekday and a time (hour and minutes), and nothing else, you’ll repeat at that time on that day of the week.
If you also need to repeat on a different day of the week, just make another notification.
- NSAttributedString alignment not working on html content
- Error: no such file or directory
- presentViewController from TableViewCell
- Remove gradient background from UIWebView?
- MapKit Display Annotation Clusters and Along With Non-Clustered Annotations
- Swift function that takes in array giving error: '@lvalue $T24' is not identical to 'CGFloat'
- iOS – Calling App Delegate method from ViewController
- Change width of a UIBarButtonItem in a UINavigationBar in swift
- iPhone — How to find topmost view controller
- Dismiss pushed view from within Navigation Controller
- Test target `MyAppTests` encountered an error (Early unexpected exit, operation never finished bootstrapping – no restart will be attempted)
- How to add image with parallax effect above UITableView header and keep header sticky
- Discrepancy in passing data between classes
- Adding particular date in default calender as an event
- Can I release an app without the device?