uilocalnotification

How do I create and cancel unique UILocalNotification from a custom class?

China☆狼群 提交于 2019-11-28 18:27:25
Currently I have a timer with an alarm (local notification). I want to create a timer class from this code to create multiple timers and notifications (at most 5) and I am struggling with how to create and cancel unique notifications with a class method. - (UILocalNotification *) startAlarm { [self cancelAlarm]; //clear any previous alarms alarm = [[UILocalNotification alloc] init]; alarm.alertBody = @"alert msg" alarm.fireDate = [NSDate dateWithTimeInterval: alarmDuration sinceDate: startTime]; alarm.soundName = UILocalNotificationDefaultSoundName; [[UIApplication sharedApplication]

Launch a local notification at a specific time in iOS

前提是你 提交于 2019-11-28 16:01:26
I am trying to create a timer which triggers a local notification to go off at a time that the user has set. The issue I am having is that I cannot figure out a way to be able to set the local notification to go off at say 7:00PM. Almost all the methods found when researching this issue involved the local notification going off at a certain amount of time from the current date. I am trying to allow the user to select 7:00PM and then have the notification go off at that time. Logically it makes sense that this can be achieved through having the final time (selected value by the user) - current

Launch a local notification at a specific time in iOS

我们两清 提交于 2019-11-28 15:24:59
问题 I am trying to create a timer which triggers a local notification to go off at a time that the user has set. The issue I am having is that I cannot figure out a way to be able to set the local notification to go off at say 7:00PM. Almost all the methods found when researching this issue involved the local notification going off at a certain amount of time from the current date. I am trying to allow the user to select 7:00PM and then have the notification go off at that time. Logically it

non-main bundle file as alert sound

匆匆过客 提交于 2019-11-28 12:59:52
I'm hoping I'm wrong but I don't think it's possible. In the Local and Push Notification Programming Guide, under "Preparing Custom Alert Sounds" it says that "The sound files must be in the main bundle of the client application". If you can't write to the main bundle, then how can you get a user generated recording (using, say, AVAudioRecorder) to play as the alert sound? On the one hand it seems impossible, but on the other I think there are apps out there that do it (and I'll look for those). I solved this by copying a system sound file to ~/Library/Sounds directory and name it as

Swift - AVAudioPlayer, sound doesn't play correctly

﹥>﹥吖頭↗ 提交于 2019-11-28 12:54:33
Because UILocalNotification is not being displayed while the application is in active stat, I'm trying to configure an UIAlertController and playing a little sound when it appears. I've no problem, in the AppDelegate , to handle the notification/create the alert. My problem concerns the sound. Indeed, it doesn't play correctly. Here is what I have so far : //... class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for

UILocalNotification when iPhone switched off

痞子三分冷 提交于 2019-11-28 12:45:49
What happens when a UILocalNotofication is scheduled when a device is switched off. Eg. I schedule a UILocalNotification at 3pm everyday. But the device is switched off from 3:00pm to 4:00pm. I guess any one of the following conditions will be true. No notification is fired after device is restarted. Notification is fired when the device is restarted i.e. at 4:00pm I do not have a device and could not test it on a simulator. Note: By switch off I mean that the device is turned off, and not sleep/stand by mode When you turn off your device, the notification becomes non-existant, so when you

Set repeatInterval in local notification

走远了吗. 提交于 2019-11-28 12:36:31
I want to set repeat interval to the value which user selects from date picker.I have date picker of type countdown mode in my application.If user selects 4 hours 15 minutes from date picker then I am setting firedate using the following code and alarm rings. [NSDate dateWithTimeIntervalSinceNow:[pickerTimer countDownDuration]] But I want that notification should repeat after every 4 hours 15 minutes until user cancels it. I have done r&d searched a lot but I can not figure out.The code I have used so far is: localNotification = [[UILocalNotification alloc] init]; [localNotification

iOS 8 [UIApplication sharedApplication].scheduledLocalNotifications empty

▼魔方 西西 提交于 2019-11-28 12:21:34
i'm trying to update my app to iOS 8. In a function i schedule a local notification (i've already checked that firedate and all other parts of the notification are right) in this way: [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; then i use this code to print the scheduled local notification: NSLog(@"notifications %@", [UIApplication sharedApplication].scheduledLocalNotifications ); but the array [UIApplication sharedApplication].scheduledLocalNotifications is empty even if the notification is not fired. Then , to check if the local notification is really

UILocalNotification custom sound is not playing in iOS7

青春壹個敷衍的年華 提交于 2019-11-28 09:06:39
I'm using UILocalNotification in an application. In the application there are two sounds which are played conditionally- I have applied proper conditions for them. But when I install the application and run it on an iOS 7 device, then it fires the local notification but a sound is not playing in the application. Code is given below to set the notification: UILocalNotification *localNotification = [[UILocalNotification alloc] init]; if (localNotification == nil) return; localNotification.fireDate = [pickerView date]; localNotification.timeZone = [NSTimeZone defaultTimeZone]; if (alarm_number ==

Can I send a Local Notification with no sound?

三世轮回 提交于 2019-11-28 07:52:30
问题 I want to have a few local notifications with no display and no sound, but only a vibration. I can get it to do no display, by simply setting alertBody to @"" , but how can I send no sound? I am thinking if I don't get a better way from you guys, that I will be able to just make a sound that is empty, add it to my project, then set soundName to that sound. But is there any sort of default way to do this? If I add a phony sound name it still plays the default notification sound. Thanks!! 回答1: