iPhone : Daily local notifications

You just need to properly create a NSDate object to be your fire date (time). Instead of using [NSDate dateByAddingTimeInterval: 20], use something like this: NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *components = [[NSDateComponents alloc] init]; [components setDay: 3]; [components setMonth: 7]; [components setYear: 2012]; [components setHour: 6]; [components setMinute: 0]; [components setSecond: 0]; [calendar … Read more

Add Local Notification in iOS 10 – Swift 3

You need to register for Notification…I tried and this works. func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. let center = UNUserNotificationCenter.current() center.requestAuthorization([.alert, .sound]) { (granted, error) in // Enable or disable features based on authorization. } return true } Edit: You dont need … Read more

Set default iOS local notification style for application

I would like to add something, since I’ve opened a TSI and somehow I asked about this and have been answered. From Quinn “The Eskimo!”: “This depends on you mean. You have some control over how the notification appears based on how you set the UILocalNotification properties (things like alertBody, soundName, and so on). However, … Read more

iPhone: Incrementing the application badge through a local notification

I’ve found, implemented & tested a ‘workaround’ for (apparantly) auto-incrementing the app icon’s badge number, that works fine with non-repeating local notifications It is indeed not possible for UILocalNotifications to have iOS ‘automatically’ update/increment the badge number when multiple local notifications are fired, and the user ‘ignores’ them or doesn’t handle them immediately, so they … Read more

How to set Local Notification repeat interval to custom time interval?

Got the answer, it is as straight as it gets. You cannot create custom repeat intervals. You have to use on NSCalendarUnit’s in-built Unit Time Intervals. I tried all the above solutions and even tried other stuffs, but neither of them worked. I have invested ample time in finding out that there is no way … Read more

Displaying a stock iOS notification banner when your app is open and in the foreground?

iOS 10 adds the UNUserNotificationCenterDelegate protocol for handling notifications while your app is in the foreground. The UNUserNotificationCenterDelegate protocol defines methods for receiving notifications and for handling actions. When your app is in the foreground, arriving notifications are delivered to your delegate object instead of displayed automatically using the system interfaces. Swift: optional func userNotificationCenter(_ … Read more

UILocalNotification Repeat Interval for Custom Alarm (sun, mon, tue, wed, thu, fri, sat)

You cannot set custom repeat intervals with UILocalNotification. This has been asked before (see below) but only limited options are provided. The repeatInterval parameter is an enum type and it limited to specific values. You cannot multiply those enumerations and get multiples of those intervals. You cannot have more than 64 local notifications set in … Read more