FAQ Database Discussion Community


How to clear all scheduled local notifications when deleting the app

ios,objective-c,iphone,uilocalnotification,nsnotifications
I am developing an iPhone app where the user can schedule local notifications as reminders. In the applicationDidBecomeActive method, I am checking the expire dates of each scheduled notification and cancel the notifications which are expired. Now my question is, if I delete the application from the phone and re-install,...

Repeating local notification daily at a set time with swift

ios,swift,cocoa-touch,uilocalnotification
I am new to iOS development, but have created the app and I am trying to create a daily notification for a set time. Currently the notification executes once for the given date/time. I am unsure how to use the repeatInterval method to schedule it daily. What is the best...

How trigger background process from Watch on iPhone (trigger: Watch)?

ios,swift,background-process,uilocalnotification,watchkit
I'd like to add to my Watch app functionality which send to iPhone app a Local Notification (while iPhone app is on the background or iPhone is locked). I know how to create Local Notification itself. What Im asking for is way, how to trigger background process (which contains also...

My app keeps giving UILocalNotifications even though there are none in the code

ios,uilocalnotification
I put some UILocalNotifications in my code as a way of telling me when I had crossed over certain geographic barriers I programmed into my app. However, I've since taken these notifications out. I have even typed in "UILocalNotification" into spotlight on my mac and seen that none of my...

UI Local Notification - Background Reschedule

xcode,swift,ios8,uilocalnotification
I'm learning to develop application for ios with swift, and I'm one doubts, already googled and i not found. I'm creating a to-do list app, and was wondering if there is a way to reschedule a notification when it appears to the user For example the user registers a task...

Changes to registerUserNotificationSettings in Swift 2?

swift,uilocalnotification,swift2
I can't seem to find any documentation on registerUserNotificationSettings beyond what was produced last November (here), but my old code doesn't seem to work for me any more in Xcode 7 and Swift 2. I have this code in App Delegate: let endGameAction = UIMutableUserNotificationAction() endGameAction.identifier = "END_GAME" endGameAction.title =...

Trigger Notification from Apple Watch

uilocalnotification,apple-watch
I'm trying to schedule a local notification to fire after a few minutes once a button is pressed on the Apple Watch (I'm testing on the actual device). This is how I'm attempting it: - (IBAction)buttonPressed { [WKInterfaceController openParentApplication: nil reply: nil { } And in AppDelegate: - (void)application:(UIApplication *)application...

Is it possible to send a local notification to the Apple Watch specifically?

ios,notifications,uilocalnotification,watchkit,apple-watch
I see this in the Apple Watch Programming Guide: When one of your app’s local or remote notifications arrives on the user’s iPhone, iOS decides whether to display that notification on the iPhone or on the Apple Watch. Is there a way to make a notification only appear on the...

Not able to add UILocalNotification multiple time

ios,iphone,uilocalnotification
I am trying to add UILocalNotification in a loop with different date like for week. When i add fire date not changing. Below is my code, please help me to fixe this issue. Thanks in advance. NSDate *now = [NSDate date]; BOOL isTimer = NO; for(i=1;i<8;i++){ NSDate *date = [now...

adding usernotification category without permission dialog popping up

ios,objective-c,uilocalnotification
Is it possible to add interactive notification categories without the notifications permissions dialog popping up? The problem is if they hit "Don't Allow" on the original notifications permissions dialog, but then later change the notification setting manually, your categories never get added and there doesn't seem to be anyway to...

Unchecking a switch depending on user decision

ios,objective-c,uialertview,uilocalnotification,uiswitch
I'm building an app that asks the user for permission to post notifications when the user enables a switch. I'm using this code: - (IBAction)mySwitchValueChanged:(id)sender { if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){ [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]]; // ask the user for permission } if ([[UIApplication...

Local Notification only during given time periode

ios,xcode,swift,uilocalnotification
i'm currently looking for a way to give the User of my App to set a time window where he will receive notifications. UILocalNotification doesn't offer such setting. I was thinking about a having "silent" notifications that trigger a new time cycle? So for example the User wants to see...

Trigger UILocalNotification from WatchKit

ios,swift,uilocalnotification,watchkit,apple-watch
I have an Xcode project in Swift with the following targets: iOS App WatchKit Extension / WatchKit App "Common" Project, used by the "main" project and by the extension In the common project I have the following code: public class func scheduleNotification(seconds: Int) { var notification = UILocalNotification() notification.fireDate =...

Trying to implement beginBackgroundTaskWithExpirationHandler and UILocalNotification

swift,uilocalnotification,uibackgroundtask
I have the following code in my AppDelegate for when my application enters the background: var backgroundUpdateTask: UIBackgroundTaskIdentifier! func beginBackgroundUpdateTask() { self.backgroundUpdateTask = UIApplication.sharedApplication().beginBackgroundTaskWithExpirationHandler({ self.endBackgroundUpdateTask() }) } func endBackgroundUpdateTask() { UIApplication.sharedApplication().endBackgroundTask(self.backgroundUpdateTask) self.backgroundUpdateTask = UIBackgroundTaskInvalid } func doBackgroundTask() {...

UILocalNotification with repeatInterval set NSWeekdayCalendarUnit doesn't trigger weekly

ios,objective-c,uilocalnotification,nscalendar
I'm trying to setup local notification to repeat weekly. Here's my setup: UILocalNotification* localNotification = [[UILocalNotification alloc] init]; ... localNotification.repeatInterval = NSWeekdayCalendarUnit; In console log: localNotif: {fire date = Friday, April 24, 2015 at 12:27:33 PM Singapore Standard Time, time zone = Asia/Singapore (GMT+8) offset 28800, repeat interval = NSWeekdayCalendarUnit,...

Scheduled UILocalNotification does not fire after when restarting app or closing app

ios,iphone,uilocalnotification
I am scheduling an UILocalNotification with the following code: UILocalNotification *notification = [[UILocalNotification alloc] init]; notification.fireDate = [[NSDate date] dateByAddingTimeInterval:60]; notification.repeatInterval = NSMinuteCalendarUnit; notification.alertBody = [NSString stringWithFormat:@"Wurmprophylaxe für Lassy”]; notification.alertAction = @"Wurmprophylaxe"; //notification.userInfo = userInfo; notification.timeZone = [NSTimeZone localTimeZone]; notification.soundName = UILocalNotificationDefaultSoundName;...

Local notification fired after deleting code

ios,uilocalnotification
I am facing a weird problem with UILocalNotifiation. I was scheduling a local notification at 11:59 every night. Now, I have deleted that code from my project but I am still receiving that local notification every night at 11:59. I have tried to remove build from device, change device and...

UILocalNotification repeatInterval keeps pushing notifications

ios,xcode,swift,uilocalnotification
When using repeatInteval the notifications keep being pushed one after the other regardless if set on Minutes/Day/Hour etc. It did seem to work fine until I tested every few seconds now settings won't change back. Any reason why ? var dateComp:NSDateComponents = NSDateComponents() dateComp.year = 2015; dateComp.month = 06; dateComp.day...

registerUserNotificationSettings doesn't display alert

ios,objective-c,alert,uilocalnotification
I'm asking the user for permission to use local notifications on iOS 8 like this: if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){ UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert; UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:types categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings]; } And I'm handling like this in my...

Weekday Local Notification Not Firing

ios,ios8,nsdate,uilocalnotification,repeat
I'm building an application that allows the user to have a local notification to repeat every weekday, because apple doesn't have a repeat interval for WeekDays I needed to create a local notification for every week day. I made a for loop looping 5 times the number of days in...

Is there a better way to check active notification settings?

ios,swift,uilocalnotification
Is there a better way in Swift to check if a specific flag is set on application.currentUserNotificationSettings().types? For example how would you check if the application is allow to update it's badge? Below is the current method I'm using, but I thought there might be a better way in Swift,...

Swift: Local notifications seem to duplicate then some vanish

swift,uilocalnotification
I have a reminder app that is searching through an array to send reminders to take a medication. When the notifications come through, I'm getting a sea of multiple notifications coming through and seemingly vanishing instantaneously and then 1 remains at the end. My initial view controller is a UITableViewController....

Swift UILocalNotification Display On Screen

ios,swift,uilocalnotification
I am trying to display a UILocalNotification on the top of the screen when it is received. I have created a simple notification var notification = UILocalNotification() notification.alertBody = "Hello World!" notification.fireDate = NSDate(timeIntervalSinceNow: 0) UIApplication.sharedApplication().scheduleLocalNotification(notification) This displays like it should in the Notifications section when the user swipes down...

local notification are sent at wrong time

ios,objective-c,iphone,ipad,uilocalnotification
I want to sent 2 local notifications daily at a particular time in iOS, But notifications are sent at wrong time and also it sends multiple times in day and not once, Here is my code snippet, - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // are you running on iOS8? if...

Swift UILocalNotification: Is it possible to fire an event when Notification is displayed?

ios,swift,uilocalnotification
So I know the didReceiveLocalNotification event is fired when a user selects an action on a Local Notification. But, is an event fired prior to that when the notification is displayed as a banner or alert when the app is not active? And can that be accessed to do some...

Reset UILocationNotification fire date set for everyday

ios,uilocalnotification
I've a function in my app which allowed to use for max. 3 times/day to a user – once he/she used it for all 3 times, they can't not use it again until next day. I'm using UILocationNotification in my app, to show a notification each day. If a user...

iOS8 UILocalNotification not working

ios,objective-c,ios8,uilocalnotification,ibeacon
I am using following code for local notification. But It is not working. Location is successfully being updated and it get into these methods but notification is not being fired. Any idea?: NOTE: It is working when the app is in background but not working when the app is closed....

Local Notifications - Repeat Interval / custom time doesn't work

cocoa-touch,notifications,uilocalnotification
Can't seem to get some basic notifications to work. I'm using local notifications to bring alarms sounds to the user. I can get a notification hourly to work. I can't seem to get one to work every half hour (every 30 minutes, or at 30 minutes or 1 hour) or...

Don't send daily Local Notification if app already opened

ios,objective-c,notifications,uilocalnotification
I'm sending a Local Notification every day at the same time. I was wondering if there were a way to not send the notification if the user had already opened the app that day? Here's the code I'm using to check if notifications are allowed, and then send the notification:...

Scheduled Local Notifications showing up when toggled ON for time period when toggled OFF

ios,objective-c,xcode,notifications,uilocalnotification
I have a daily scheduled notification at 8:30:01 PM. When the Notifications are toggled OFF in Settings app for a week, no notifications show up, which is perfect. The problem is when Notifications are toggled back ON in Settings app after that week, all of the Notifications for the previous...

UILocalNotification and region monitoring

ios,uilocalnotification,geofencing,clregion
I am rolling a notification service into an existing app that requires geofenced notifications. CLRegion looks like how you are supposed to do this, a la the Apple way. However, they limit you to 20 regions that can be monitored by a single application. There are definitely going to need...

UILocalNotification Geofence: Ignore exiting region

ios,objective-c,core-location,uilocalnotification,geofencing
I want to use the new Geofence API of iOS 8 (scheduleLocalNotification:). I schedule a UILocalNotification with a region and so on. Everything works, but how can I differentiate between ENTERING and EXITING a region, resp. ignore EXITING? iOS always displays/sends a notification, but I only want a notification when...

Detect battery level when app is closed in iOS

ios,background,uilocalnotification,batterylevel
I'm building an app in iOS that will need to detect when the battery reaches a low level to send a notification. When the app is running this is simple, just by detecting the UIDeviceBatteryLevelDidChangeNotification notification and inspecting the current battery level. However, is it possible to receive this type...

iOS UILocalNotification only makes a sound (no alert) when app is not running

ios,apple-push-notifications,uilocalnotification
I'm using remote notifications to wake up my app and conditionally trigger a UILocalNotification. I've found that if this notification is triggered while the app is not running, all I get is the notification sound (no alert/notification). It works as expected if the app is in the background. Registering for...

Yahoo Weather app doing the undoable - iOS

ios,background-process,uilocalnotification
6 months ago I wanted to wake my app for 30 sec from background (terminated app) to download few lines of XML and parse it, but after trying with background fetch and silent push and reading articles online I came to conclusion that what I'm trying to accomplish is not...

iOS 8 registerForRemoteNotifications correct implementation placing

ios,objective-c,apple-push-notifications,uilocalnotification
I've seen a ton of different notifications permission request implementations and I still don't know which one is best. This might be a duplicate but I want a 2015 answer that should encase the latest Apple recommendations. My general question is whether to put the registerForRemoteNotifications call immediately before the...