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

Custom repeat interval for UILocalNotification

Thanks for trying our app! It turns out, we’re not actually using UILocalNotification repeatInterval to accomplish that. Given it’s limitations (only one NSCalendarUnit), we actually wrote our own scheduler. This has it’s own limitations, mainly the 64 local notification queue limit per app. We essentially schedule and build our own queue, then fill the local … Read more

Is there a simple way to edit / modify a UILocalNotification

If the documentation is correct, you can’t alter an already scheduled notification. The doc states for -scheduleLocalNotification:: […] Because the operating system copies notification, you may release it once you have scheduled it. The notification object is copied by the system and not accessible via any (public) method. So there’s no other solution than canceling … Read more

Local and Push Notifications in IOS version compatible

IOS 12 :- Group notification set threadIdentifier UNMutableNotificationContent to create group notification create local notification group let content = UNMutableNotificationContent() content.title = “Group Notifications” content.body = “Body of notification” content.threadIdentifier = “group-identifire” create remote notification group need to pass thread-id in payload { “aps” : { “alert” : { “title” : “Group Notifications”, “body” : … Read more

Alternative to UserNotificationCenterDelegate’s willPresent when app is in background

For iOS 10 local notifications your out of luck. For iOS 10 remote notifications —regardless of user interaction you can receive callbacks using application(_:didReceiveRemoteNotification:fetchCompletionHandler:). (It’s kind of confusing that they deprecated most notification related methods but not this one) Callback for when app is in foreground and you’re about to show the notification: func userNotificationCenter(_ … Read more

Fire local notification every day on different times

According to Apple documentation: An application can have only a limited number of scheduled notifications; the system keeps the soonest firing 64 notifications (with automatically rescheduled notifications counting as a single notification) and discards the rest I solved that problem by setting a “queue” of notifications. For example, in my app I have three different … Read more

detect “Allow Notifications” is on/off for iOS8

Method enabledRemoteNotificationTypes is deprecated since iOS8. To check remote notifications status in iOS8 you can call [[UIApplication sharedApplication] isRegisteredForRemoteNotifications]; it will return NO if user disable notifications in Settings. Documentation on isRegisteredForRemoteNotifications Or you can retrieve all current notification settings: [[UIApplication sharedApplication] currentUserNotificationSettings]; Documentation on currentUserNotificationSettings

Ask for User Permission to Receive UILocalNotifications in iOS 8

Since iOS 8 you need to ask user’s permission to show notifications from your app, this applies for both remote/push and local notifications. In Swift you can do it like this, Update for Swift 2.0 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { // Override point for customization after application launch. if(UIApplication.instancesRespondToSelector(Selector(“registerUserNotificationSettings:”))) { let … Read more