uilocalnotification

Set local notifications for particular days and time swift 3

喜你入骨 提交于 2019-12-06 04:33:43
In my app, i want to add local notifications. The scenario will be that the user can select any time and days from Mon to Sun. For example, if the user selects Mon, Thur and Sat as days and time as 11:00 pm, so now the user should be notified at all the selected days and that particular time. Code: let notification = UNMutableNotificationContent() notification.title = "Danger Will Robinson" notification.subtitle = "Something This Way Comes" notification.body = "I need to tell you something, but first read this." let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 60,

UILocalNotification not doing anything

匆匆过客 提交于 2019-12-06 03:40:49
This may seem like a silly question, but this is my first time using UILocalNotification and I can't get it to work for a quick test. It just doesn't do anything. 1. I've created 2 variables in the AppDelegate let today = NSDate() let notification: UILocalNotification = UILocalNotification() 2. Then in the applicationDidEnterBackground function, I have the following notification.fireDate = today.dateByAddingTimeInterval(10) notification.alertTitle = "My App Test" notification.alertBody = "Testing Notification \n :)" UIApplication.sharedApplication().presentLocalNotificationNow(notification)

How to remove the cancel ApplicationIconBadgeNumber from LocalNotification?

五迷三道 提交于 2019-12-06 03:08:57
I am using LocalNotification in my app. It is working fine but once ApplicationIconBadgeNumber is set, not able to remove it from App. How to remove it? You need to set the application applicationIconBadgeNumber. For example in the application didReceiveLocalNotification. - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notif { application.applicationIconBadgeNumber = notif.applicationIconBadgeNumber-1; } 来源: https://stackoverflow.com/questions/5553179/how-to-remove-the-cancel-applicationiconbadgenumber-from-localnotification

How to set up weekly repeating UILocalNotifications with iOS 8 deprecations?

让人想犯罪 __ 提交于 2019-12-06 02:16:27
问题 Prior to iOS 8, scheduling weekly repeating notifications was easy, we just assigned NSWeekCalendarUnit to the notification.repeatInterval value. Now with iOS 8, pretty much all the NSCalendarUnit values have been deprecated and replaced, mostly so Apple could rename them from NSDayCalendarUnit to NSCalendarUnitDay for consistency. However, they changed NSWeekCalendarUnit into NSCalendarUnitWeekOfMonth and NSCalendarUnitWeekOfYear , with no clear explanation of what the difference is, and the

How to Run a Task in swift on a particular date-time in background either application is on or off

隐身守侯 提交于 2019-12-06 02:12:13
问题 I am working on alarm application, i need to schedule alarm on specific time, I use scheduleLocalNotification for scheduling alarms and it's working fine as i want. BUT I need to run to a request to my API server before triggering alarm. In that request I want to check some parameters returning from API server, If that satisfies some condition. If any one have a method that run on a particular date - time in swift Please help me for that func addAlarm (newAlarm: Alarm) { // Create persistent

iOS UILocalNotification not being displayed while app in background

孤者浪人 提交于 2019-12-06 00:02:50
FIXED — Ok, found what it was, there was an errant [[UIApplication sharedApplication] cancelAllLocalNotifications]; being fired when I wasn't expecting it. Well there's your problem. Thanks for the help everyone, sorry to have it turn out to just be dumb coder syndrome. I've built out my local notification like so: - (void)scheduleNotification { [[UIApplication sharedApplication] cancelAllLocalNotifications]; Class cls = NSClassFromString(@"UILocalNotification"); if (cls != nil) { UILocalNotification *notif = [[cls alloc] init]; NSLog(@"%@", [NSDate date]); notif.fireDate = [NSDate

Local Notification When didEnterRegion?

眉间皱痕 提交于 2019-12-05 23:59:36
I have the following code which work perfect when app terminated. -(void)beaconManager:(id)manager didEnterRegion:(CLBeaconRegion *)region{ UILocalNotification *notification = [UILocalNotification new]; notification.alertBody = @"TEST NOTIFICATION"; notification.soundName = UILocalNotificationDefaultSoundName; [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; } But When I do the following: -(void) createTestNotification { UILocalNotification *notification = [UILocalNotification new]; notification.alertBody = @"TEST"; notification.soundName =

didReceiveLocalNotification method not called in app delegate when app is in background [iOS6]

别等时光非礼了梦想. 提交于 2019-12-05 22:30:52
I have added a local notification, it is getting triggered as well by displaying a banner on iOS6 and displaying alert in iOS5. But in iOS6 the "didReceiveLocalNotification" method in app delegate is not getting called. How can I know that a notification has occurred when the application is in the background ? Thanks. Leena It will never gets called in background. It will be called when your app is in foreground. Check UIApplicationDelegate Protocol Reference link for more info 来源: https://stackoverflow.com/questions/13678499/didreceivelocalnotification-method-not-called-in-app-delegate-when

Handling local notifications when the user presses the icon instead of the alert

依然范特西╮ 提交于 2019-12-05 20:53:47
Here is the situation that I want to handle quoted from Apple's documentation. As a result of the presented notification, the user taps the action button of the alert or taps (or clicks) the application icon. If the action button is tapped (on a device running iOS), the system launches the application and the application calls its delegate’s application:didFinishLaunchingWithOptions: method (if implemented); it passes in the notification payload (for remote notifications) or the local-notification object (for local notifications). If the application icon is tapped on a device running iOS, the

iOS – UILocalNotification fired twice for same notification

蓝咒 提交于 2019-12-05 20:36:44
If I schedule two UILocalNotification s and set them both to fire at the exact same fireDate. Then on the device (this is not the simulator bug) on the fireDate the application:didReceiveLocalNotification: will fire 4 times (2 times for each notification). Is this a known bug? Because I have not been able to find any information about it. Robotic Cat Please report the bug to http://bugreport.apple.com . Having said that, it has been noticed before that while there is the bug in the simulator there also appears to be a bug on the device. See the comments and answers on this SO question: local