uilocalnotification

IOS, how to handle multiple local notifications when app start?

时光总嘲笑我的痴心妄想 提交于 2020-01-05 05:46:09
问题 I'm creating an app that uses timers. Let's say that the user can set multiple timers; for each of those timers the app schedule a local notification. When the app is running in foreground or is in background i have no problem handling multiple local notifications. my problem is when the user set multiple timers and then terminate the app ( double click on home button and close the app). in that case, when timers expire all relative local notifications are shown as a banner and the app icon

Why does it return nil when I unwrap the array of strings in localNotification?

北城余情 提交于 2020-01-05 05:19:21
问题 notificationTime = ["2016-05-26 16:27:17 +0000","2016-05-24 13:29:37 +0000"] var num = 0 func locaNotification(num:Int) { let dateFormatter = NSDateFormatter() dateFormatter.locale = NSLocale.currentLocale() dateFormatter.dateStyle = NSDateFormatterStyle.FullStyle var dateAsString = notificationTime[num] dateFormatter.dateFormat = "yyyy-MM-dd HH:mm" var newDate = dateFormatter.dateFromString(dateAsString)! It returns nil when it is unwrapped here, newDate = nil after the previous line of code

How implement scheduling event with post a message on fb

五迷三道 提交于 2020-01-05 04:42:10
问题 I am creating an application in which I have add a facility for post message on ur account. Now this facility I am adding an event for scheduling. With help of that user can write a message and post that later or on particular date and time. For this I used a local notification event which is generate on given date by user. But problem is that when notification generate then I have call a function which is used for post message on Facebook. For generate notification I have used this code: -

Does launchOptions 'UIApplicationLaunchOptionsLocalNotificationKey' contain NSDictionary or UILocalNotification

可紊 提交于 2020-01-04 05:41:14
问题 OK, so i've read various articles on how to check the local notifications in didfinishlaunchingwith options. For example this NSHipster article claims that remote and local keys both contain an NSDictionary. http://nshipster.com/launch-options/ However, i tested and it contains a UILocalNotification, and some other articles says so as well. So, i've looked around but not found any definitive answer. Is this an OS Version issue? Do different versions contain different objects, or what?

Swift 3 Local notifications not firing

独自空忆成欢 提交于 2020-01-04 02:40:12
问题 I have the following setup and no notification are firing at all. Based on other similar questions on the stack, I've put in a unique identifier for each request and I've also added the body to the content. I've got this function which requests permission from user. func sendIntNotifications() { //1. Request permission from the user UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound], completionHandler: { (granted, error) in if granted { print (

Sounds in UILocalNotification louder than AVAudioPlayer at max volume

旧时模样 提交于 2020-01-03 03:13:06
问题 For purposes of this question, imagine my app plays an audio clip every 10 seconds. This audio plays/mixes with the iPod music player on the device (using ducking), using AVAudioPlayer. When the app is sent to the background, I schedule UILocalNotification objects with the audio file referenced (and no text), so the sounds continue to play at 10 second intervals. What is bothering me is that the volume of the audio clips played as part of a notification on iOS 6 seem to be twice as loud as

Local Notification repetation at different times

丶灬走出姿态 提交于 2020-01-03 02:56:38
问题 I have an app that generates prayer times (5 times a day) i want to create notfication for the 5 prayers but the issue is the times change everyday based on some calculations. Edit: The calculations are done based on GPS location so when the user changes to another city the times will be updated accordingly. I input the date,timezone, GPS coordinates into a method and I get prayer time values in (HH:mm) format for that given day/location. Now I need to setup the Notfications. I'm not sure

Local Notification sound not playing?

人走茶凉 提交于 2020-01-03 02:55:11
问题 I'm having this problem with the Local notifications, they are not playing the sound. I tested with the default one and the custom one that is obviously the one I want to play but nothing! I looked and a lot of people face this problem but none of their solutions worked for me. UILocalNotification *local - (IBAction)Dateaction:(id)sender { local = [[UILocalNotification alloc]init]; local.timeZone = [NSTimeZone defaultTimeZone]; local.alertBody = [NSString stringWithFormat:@"%@ Recuerda que

UILocalNotification: Playing a Custom Audio File saved in Documents Directory

丶灬走出姿态 提交于 2020-01-02 07:52:19
问题 Currently I am creating an alarm app that plays custom audio clips from the server. My plan on implementing this is by saving all the audio clips locally and then setting the soundName accordingly. But I am having a few issues. Currently I am having troubles saving the audio files in the bundle directory and only able to save the files in the document directory. Would it be possible to set the soundName from the document directory instead of the bundle directory? OR would it be possible for

Why local notification is repeated after 1 minute when the repeat interval is set 1 sec(NSSecCalendarUnit)?

て烟熏妆下的殇ゞ 提交于 2020-01-02 07:21:29
问题 I am trying to schedule a local notificaition that will repeat after every 1 sec once the notification is fired. The notification is fired 10 sec after the application starts. UILocalNotification *notif = [[cls alloc] init]; notif.fireDate = [[NSDate alloc]initWithTimeInterval:10 sinceDate:[NSDate date]]; notif.timeZone = [NSTimeZone defaultTimeZone]; notif.alertBody = @"Did you forget something?"; notif.alertAction = @"Show me"; //notif.soundName = UILocalNotificationDefaultSoundName; notif