uilocalnotification

UILocalNotification play sound from app documents

一世执手 提交于 2019-12-21 16:57:48
问题 I know that UILocalNotification supports soundName only from app bundle, but I saw program that plays my recorded sound in Notification, even if program is closed. How to implement it? Any ideas is very important for me.. 回答1: A surefire way to get an NSURL to the application documents directory is like this... NSURL *documentsDirectoryURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; Then you can get an NSURL reference to

UILocalNotification play sound from app documents

孤人 提交于 2019-12-21 16:56:02
问题 I know that UILocalNotification supports soundName only from app bundle, but I saw program that plays my recorded sound in Notification, even if program is closed. How to implement it? Any ideas is very important for me.. 回答1: A surefire way to get an NSURL to the application documents directory is like this... NSURL *documentsDirectoryURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; Then you can get an NSURL reference to

UILocalNotification fires after reinstalling the app

一世执手 提交于 2019-12-21 12:49:10
问题 My app has an alarm function using UILocalNotification, and it works great. However, if the user uninstalls the app, then later REINSTALLS it, he would receive all the "in between" notifications at once. I have tried to call: [[UIApplication sharedApplication] cancelAllLocalNotifications]; if it's the first time the app is launched, but it doesn't help, because the notification is received even before application:didFinishLaunchingWithOptions: is called. This was worse in 4.0 when the alarm

Custom iOS UILocalNotification sound does not play (possibly related to Xcode update)

自作多情 提交于 2019-12-21 12:28:14
问题 I'm trying to get a custom sound working on a UILocalNotification , and I'm just getting no sound at all. If I use UILocalNotificationDefaultSoundName , I indeed get the default sound, but when the custom sound is specified, there is no sound, just the message. The sound is less than 30 seconds and it's in the right format, as far as I can tell. Here's a screenshot of the file info: I've inspected the .app directory in XCode's DerivedData directory, and the alarm.caf file is at the root of

Local notification sound not working

若如初见. 提交于 2019-12-21 06:18:34
问题 I'm trying to make an alarm app but when I try to make a local notification I am unable to play the sound. I got this error: [user info = (null)} with a sound but haven't received permission from the user to play sounds] Here is the code: @IBOutlet var setAlaram: UIDatePicker! @IBAction func setAlarmButton(sender: AnyObject) { var dateformater = NSDateFormatter() dateformater.timeZone = NSTimeZone .defaultTimeZone() dateformater.timeStyle = NSDateFormatterStyle.ShortStyle dateformater

Update fire date for local notification and cancel previous notification

孤街醉人 提交于 2019-12-21 05:16:09
问题 I know there are a few questions here and there regarding how to delete a local notification which might be all or a particular notification. I have also gone through the local notification class reference and found some methods like repeat time interval,fire date,alert body,time zone etc...but I am unable to find out some sort of information regarding how to modify the fire date that is already been set. Say if the user sets a notification with date today and time 4:50 PM, but if the user

Update fire date for local notification and cancel previous notification

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 05:16:02
问题 I know there are a few questions here and there regarding how to delete a local notification which might be all or a particular notification. I have also gone through the local notification class reference and found some methods like repeat time interval,fire date,alert body,time zone etc...but I am unable to find out some sort of information regarding how to modify the fire date that is already been set. Say if the user sets a notification with date today and time 4:50 PM, but if the user

Show an image in the alert body of a local notification

喜夏-厌秋 提交于 2019-12-21 03:02:12
问题 I am using Local Notifications, but I want to put an image in the message body of the alert. How can I do that? 回答1: I also searched for the same question. And found that we can't customize the UILocalNotification , so I handled this in application:didReceiveLocalNotification: by showing custom UIAlertView . 回答2: This should work. Give it a whirl: UIAlertView *successAlert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

registerUserNotificationSettings not showing prompt iOS 8

冷暖自知 提交于 2019-12-21 02:00:50
问题 I can't seem to get a prompt to show for registerUserNotificationSettings in iOS 8.1 or 8.2. Here is what I'm doing in didFinishLaunchingWithOptions : if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) { #ifdef __IPHONE_8_0 UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeAlert |UIUserNotificationTypeSound | UIUserNotificationTypeBadge) categories:nil]; NSLog(@"Reg settings %@", settings); [application

IOS Overriding Local Notifications

别说谁变了你拦得住时间么 提交于 2019-12-20 07:39:47
问题 I created a Local Notification that triggers 60 seconds when a certain button( SetButton ) is clicked. My problem right now is if SetButton is pressed again, it does not override the first press, it displays 2 notifications and so on. How do I make sure that the second press of the button overrides the first press and there isn't a build up of notifications ? - (IBAction)SetButtonPressed:(id)sender { UILocalNotification *localNotification = [[UILocalNotification alloc] init];