uilocalnotification

Repeat UILocalNotification daily at 5 pm

烈酒焚心 提交于 2019-12-01 09:26:05
问题 How to repeat UILocalNotification daily at 5 pm ? Following is my code to set custom time. But i want to notify the user daily at custom or may be static time. I am using iOS 6. -(void)scheduleNotification{ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"h:mm a"]; NSDate *dateFromString = [[NSDate alloc] init]; dateFromString = [dateFormatter dateFromString:timeStr]; UILocalNotification *localNotif = [[UILocalNotification alloc] init]; if

uilocalnotification is not firing at exact time

血红的双手。 提交于 2019-12-01 08:21:53
I want to implement uilocalnotification in my app. but the problem is that it is not firing at the exact time. it is firing after 30 - 40 secs from the given firing time. Is there something I am missing or this is a common think in UILocalNotification . Thanks UILocalNotification is designed for things that are happening far in the future so an error of 30 seconds would be OK (i.e. if I had a meeting at 15:00 then telling me at 15:00:30 wouldn't be a problem :) If you want more accuracy than that you will need to keep your app running and use an NSTimer. Jazzmanouch I know this is an old

Remove a local notification from iPhone by Date

余生颓废 提交于 2019-12-01 08:15:57
there is the possibility of a LocalNotification on the iPhone to load on a date? My problem is that I create an event for the notification but i release the object after creation. Or can I just create a new Object with the same data to delete my Notification? sorry for my english... scheduledLocalNotifications will give you the list of all scheduled notifications and use - (void)cancelLocalNotification:(UILocalNotification *)notification or you can cancel them all using: [[UIApplication sharedApplication] cancelAllLocalNotifications]; 来源: https://stackoverflow.com/questions/5866146/remove-a

Schedule Interactive UILocalNotification - Obj-C

北战南征 提交于 2019-12-01 08:11:17
问题 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

uilocalnotification is not firing at exact time

混江龙づ霸主 提交于 2019-12-01 06:49:16
问题 I want to implement uilocalnotification in my app. but the problem is that it is not firing at the exact time. it is firing after 30 - 40 secs from the given firing time. Is there something I am missing or this is a common think in UILocalNotification . Thanks 回答1: UILocalNotification is designed for things that are happening far in the future so an error of 30 seconds would be OK (i.e. if I had a meeting at 15:00 then telling me at 15:00:30 wouldn't be a problem :) If you want more accuracy

actions and categories don't show in UILocalNotification in iOS

旧街凉风 提交于 2019-12-01 06:37:29
I have the following which I believe from the apple documentation here is all I need to have a category for UILocalNotification : - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIMutableUserNotificationAction *acceptAction = [[UIMutableUserNotificationAction alloc] init]; // Define an ID string to be passed back to your app when you handle the action acceptAction.identifier = @"ACCEPT_IDENTIFIER"; // Localized string displayed in the action button acceptAction.title = @"Accept"; // If you need to show UI, choose foreground

actions and categories don't show in UILocalNotification in iOS

一个人想着一个人 提交于 2019-12-01 04:53:03
问题 I have the following which I believe from the apple documentation here is all I need to have a category for UILocalNotification : - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIMutableUserNotificationAction *acceptAction = [[UIMutableUserNotificationAction alloc] init]; // Define an ID string to be passed back to your app when you handle the action acceptAction.identifier = @"ACCEPT_IDENTIFIER"; // Localized string displayed in

Are scheduled UILocalNotifications part of iOS device backup?

让人想犯罪 __ 提交于 2019-12-01 04:07:49
I mean, our app schedules a couple of local notifications. User makes a backup of the system and restores it on a new device. Will previously scheduled local notifications fire on the new system, or do we need to reschedule them again on the new system? Finally I forced myself to do the test. The result: YES - scheduled local notifications are part of backup , this means they are restored and scheduled on the new device. The restore overwrites any previously scheduled local notifications for the same app on the target device. Even icon badge number is preserved in backup and restored to the

UILocalNotification custom sound

蓝咒 提交于 2019-12-01 03:54:56
I have been searching for a solution for hours.. with absolutely zero luck. I set up a Local Notification: UILocalNotification *notif = [[cls alloc] init]; [dateComp setDay:j+1]; [dateComp setHour:[[time objectAtIndex:0] integerValue]+offset]; [dateComp setMinute:[[time objectAtIndex:1] integerValue]]; NSLog(@"Year: %i, Month: %i, Day: %i, Time:%i:%i\n",[dateComp year], [dateComp month], [dateComp day], [dateComp hour], [dateComp minute]); notif.fireDate = [gregorian dateFromComponents:dateComp]; notif.timeZone = [NSTimeZone defaultTimeZone]; notif.alertBody = [names objectAtIndex: k]; notif

iPhone - UILocalNotification as alarm

▼魔方 西西 提交于 2019-12-01 01:36:19
Even when my iPhone application is in background, How can I use UILocalNotification to show my alram every day at 8.00 PM? Set the fireDate to 8.00 PM and set the repeatInterval to NSDayCalendarUnit and schedule the alert with [[UIApplication sharedApplication] scheduleLocalNotification: myNotification]; dasdom answer is correct. just wanted to add to it that the alarm will not make a sound if your device is in silent mode. It is a restriction from Apple for UILocalNotification. UILocalNotification *localNotification =[[UILocalNotification alloc]init]; NSCalendar *calendar=[NSCalendar