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!
- Run task when app is closed
- UILocalNotification custom sound is not playing in iOS7
- Get the soundName by soundID to assign it to a UILocalNotification
- Stop UILocalNotification Sound on slide to view
- iOS set local notification on a specific day
- Scheduled Local Notifications showing up when toggled ON for time period when toggled OFF
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.
- Having trouble with MusicKit sample app provided by Apple
- How to use Speech Recognition inside the iOS SDK?
- How to fix Allocations problem?
- Calling Objective-C method from C++ method?
- Connection Interval Core Bluetooth
- Loading images from a URL into a UITableViewCell's UIImageView
- Overriding touchesBegan in Swift
- Draw/Paint like sketch color inside a bezier path in UIView
- Check for “Release Build” at runtime
- Strip out html tags from a string
- iOS – High pass filter equation for accelerometer
- Does iOS 8 support dynamic linking?
- Swift globals and global functions in objective c
- how to make deinit take effect in swift
- What is the property block declaration equivalent in swift of the following block property?