Delete a particular local notification

You can save a unique value for key in your local notification’s userinfo. Get all local notification, loop through the array and delete the particular notification. Code as follows, OBJ-C: UIApplication *app = [UIApplication sharedApplication]; NSArray *eventArray = [app scheduledLocalNotifications]; for (int i=0; i<[eventArray count]; i++) { UILocalNotification* oneEvent = [eventArray objectAtIndex:i]; NSDictionary *userInfoCurrent = … Read more

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

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