uilocalnotification

iOS set local notification on a specific day

六眼飞鱼酱① 提交于 2019-12-02 01:26:06
问题 I am sure this question is duplicated somewhere, but I can't find a solution. I am making an app in which one feature allows the user to select the days and times they will receive a local notification. They can select any time of the day they like, and can toggle the different days of the week (mon, tues, weds etc). The notifications will be sent weekly. I therefore limit the user to creating just 3 notifications - if all 7 days are selected I will set the repeatInterval to daily (one

scheduled local notification is not being stored in the scheduledLocalNotification array

会有一股神秘感。 提交于 2019-12-01 22:45:14
I am currently scheduling local notifications to appear once per day at 6PM if a user has not already opened the app that day. If the user has already loaded the application, then I want to cancel the notification for that day and schedule a new one for tomorrow at 6PM. The notification displays properly, however, when I try to iterate of the list of scheduled notifications (this is not the only local notification I have in the application), the [[UIApplication sharedApplication] scheduledLocalNotifications] array is always empty. Below is the code snippet that is giving me trouble: // See if

redraw GUI on didreceivelocalnotification when come from lock screen iphone

有些话、适合烂在心里 提交于 2019-12-01 22:20:34
问题 How do I prevent my GUI from redraw when it comes back from lock screen after receiving a UILocalNotification? In didReceiveLocalNotification I present a modal view, but the old state of my view controllers is shown for a moment before that. How do I prevent this? Also the order of events I get when I come back on local notification from background is as following: 1. UIApplicationWillEnterForegroundNotification 2. UIApplicationDidBecomeActiveNotification 3. didReceiveLocalNotification When I

UILocalNotification - Fire and Repeat at particular time each day

喜你入骨 提交于 2019-12-01 14:29:48
I have this piece of code which I use for firing a local notification each day at mid night: //Get todays midnight NSDate *alertTime = [NSDate date]; NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar]; NSUInteger preservedComponents = (NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit); alertTime = [calendar dateFromComponents:[calendar components:preservedComponents fromDate:alertTime]]; UIApplication *app = [UIApplication sharedApplication]; //Set up the local notification UILocalNotification *notification = [[UILocalNotification alloc] init]; if(notification){ //Set

UIlocalNotification did now appear without starting background task

断了今生、忘了曾经 提交于 2019-12-01 13:21:40
问题 I have a voip application. I am using UILocalNotification in my application to alert notification for incoming call when application in background. When application is in background, after getting an incoming call following function is called. -(void)showLocalNotification:(NSNotification *)notification { NSDictionary *dic = notification.userInfo; NSString *msg = [dic objectForKey:@"msg"]; NSString *sound = [dic objectForKey:@"sound"]; [[UIApplication sharedApplication]

Fire UILocalNotification in a specific Date

末鹿安然 提交于 2019-12-01 12:56:42
I want to fire a UILocalNotification in a specific Date. If I use this code: NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *components = [gregorian components:NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit fromDate:[NSDate date]]; [components setHour:4]; [components setMinute:0]; NSDate *fireDate = [gregorian dateFromComponents:components]; If now it's 3 pm this works fine, but it doesn't when, for example, it's 5 pm. How can I set the notification fire date to "the next 4 pm" ? NSCalendar *gregorian = [[NSCalendar

Daily Local Notification In Swift iOS 9.2

若如初见. 提交于 2019-12-01 12:25:10
问题 Trying to send a daily local notification in swift. However it just sends every minute for some reason. I want the first notification to send 30 mins after the app is opened and then repeat this notification everyday. in the swift fie i have the following code: //---------Daily notification code (also add section in app delagate---------- let theDate = NSDate() let dateComp = NSDateComponents() dateComp.minute = 30 let cal = NSCalendar.currentCalendar() let fireDate:NSDate = cal

UILocalNotification every 30 seconds

天涯浪子 提交于 2019-12-01 12:19:38
I am trying to setup a UILocalNotification to run every 30 seconds using the following logic, however it seems to be misbehaving. There are 2 issues: When the notifications get fired there seems to be a lot of them all at once, rather than 1 every 30 seconds. The application icon badge number doesn't seem to increase. It just stays at 1. Please can someone help me work out what I've done wrong? // Create 'base' notification we can use UILocalNotification *baseNotification = [[UILocalNotification alloc] init]; baseNotification.timeZone = [NSTimeZone defaultTimeZone]; baseNotification

Fire UILocalNotification in a specific Date

不打扰是莪最后的温柔 提交于 2019-12-01 11:44:03
问题 I want to fire a UILocalNotification in a specific Date. If I use this code: NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *components = [gregorian components:NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit fromDate:[NSDate date]]; [components setHour:4]; [components setMinute:0]; NSDate *fireDate = [gregorian dateFromComponents:components]; If now it's 3 pm this works fine, but it doesn't when, for example, it's 5

Schedule Interactive UILocalNotification - Obj-C

萝らか妹 提交于 2019-12-01 10:35:59
I'm trying to schedule an interactive UILocalNotifaction . My attempt has been to use the following code, which I grabbed from this tutorial : NSString * const NotificationCategoryIdent = @"ACTIONABLE"; NSString * const NotificationActionOneIdent = @"ACTION_ONE"; NSString * const NotificationActionTwoIdent = @"ACTION_TWO"; - (void)registerForNotification { UIMutableUserNotificationAction *action1; action1 = [[UIMutableUserNotificationAction alloc] init]; [action1 setActivationMode:UIUserNotificationActivationModeBackground]; [action1 setTitle:@"Action 1"]; [action1 setIdentifier