uilocalnotification

How to set up weekly repeating UILocalNotifications with iOS 8 deprecations?

夙愿已清 提交于 2019-12-04 05:18:32
Prior to iOS 8, scheduling weekly repeating notifications was easy, we just assigned NSWeekCalendarUnit to the notification.repeatInterval value. Now with iOS 8, pretty much all the NSCalendarUnit values have been deprecated and replaced, mostly so Apple could rename them from NSDayCalendarUnit to NSCalendarUnitDay for consistency. However, they changed NSWeekCalendarUnit into NSCalendarUnitWeekOfMonth and NSCalendarUnitWeekOfYear , with no clear explanation of what the difference is, and the UILocalNotification documentation still talks in terms of the deprecated values. I want a

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

爱⌒轻易说出口 提交于 2019-12-04 04:57:21
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 the app, which I believe means it's in the bundle (right?). I'm pretty sure this was working a while ago,

UILocalNotification issue with iOS9

别来无恙 提交于 2019-12-04 03:13:42
Since iOS9, local notification aren't working properly. Sometimes users receive the notification, sometimes they just don't. My notifications are repeated daily. Any idea what might causing the issue? I saw some posts, that there's a bug in iOS9, but I'm not sure that's the reason. Here's a piece of code: NSDate *alarmDate = [date dateByAddingTimeInterval:DEFAULT_SNOOZE_DURATION * i]; UILocalNotification *localNotif = [[UILocalNotification alloc] init]; localNotif.fireDate = alarmDate; localNotif.timeZone = nil; localNotif.alertBody = alertBody; localNotif.hasAction = YES; localNotif

Multiple Local Notification in iPhone

江枫思渺然 提交于 2019-12-03 21:45:33
In my app, I have list of friends say: 3 friends, all these three have birthday details. I need to schedule local notification to show their b’days alert. I know and handled a local notification but how will I handle these multiple notification? I am setting fire date in "for loop”.Is it proper, See the code. UILocalNotification *localNotif = [[UILocalNotification alloc] init]; if (localNotif == nil) return; NSDateFormatter *formatter = [[[NSDateFormatter alloc]init]autorelease]; for (int i = 0; i< [delegate.viewController.contactList count] ; i++) { NSString *birthday = [[myArray

How to create a date object for tomorrow at 8am

坚强是说给别人听的谎言 提交于 2019-12-03 21:40:45
I am normally pretty good with this, but I am having trouble with the NSDate object. I need a NSDate object set for tomorrow at 8am (relatively). How would I do this and what is the simplest method? John Sauer Here's how WWDC 2011 session 117 - Performing Calendar Calculations taught me: NSDate* now = [NSDate date] ; NSDateComponents* tomorrowComponents = [NSDateComponents new] ; tomorrowComponents.day = 1 ; NSCalendar* calendar = [NSCalendar currentCalendar] ; NSDate* tomorrow = [calendar dateByAddingComponents:tomorrowComponents toDate:now options:0] ; NSDateComponents*

Local notification sound not working

半城伤御伤魂 提交于 2019-12-03 20:31:53
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.dateStyle = NSDateFormatterStyle.ShortStyle var datetimestring = NSString() datetimestring = dateformater

Trying to implement beginBackgroundTaskWithExpirationHandler and UILocalNotification

百般思念 提交于 2019-12-03 17:38:54
问题 I have the following code in my AppDelegate for when my application enters the background: var backgroundUpdateTask: UIBackgroundTaskIdentifier! func beginBackgroundUpdateTask() { self.backgroundUpdateTask = UIApplication.sharedApplication().beginBackgroundTaskWithExpirationHandler({ self.endBackgroundUpdateTask() }) } func endBackgroundUpdateTask() { UIApplication.sharedApplication().endBackgroundTask(self.backgroundUpdateTask) self.backgroundUpdateTask = UIBackgroundTaskInvalid } func

Check for launching from UILocalNotification in Swift

依然范特西╮ 提交于 2019-12-03 13:34:15
问题 This is a follow-up question to How to check launchOptions in Swift? - I got my app to launch successfully without crashing, but I can't seem to correctly detect when the app is launching from a notification vs a normal launch. I am creating my UILocalNotification like so: // set up a frequently recurring notification here just for testing... var fast = UILocalNotification() fast.fireDate = NSDate(timeIntervalSinceNow: 15) fast.alertBody = "Alert Message" fast.timeZone = NSTimeZone

Snooze local Notification

醉酒当歌 提交于 2019-12-03 13:06:15
问题 I am working on an alarm application and I am using local notification for that. Now I want to add snooze functionality to my alarm. I searched on Google and found that iPhone doesn't support such functionality. But is there another way to do this? 回答1: AFAIK you can't add a custom behaviour when the notification windows pops up. BUT... You can try it like this: after the user has clicked "View" and the app is launched by an UILocalNotification, you could open a modal view with a huge button

How To Use UILocalNotification In Swift

て烟熏妆下的殇ゞ 提交于 2019-12-03 12:29:56
问题 I am trying to figure out how to setup a UILocalNotification in swift but I am not having a lot of luck. I am trying this: var notification = UILocalNotification() notification.timeZone = NSTimeZone.defaultTimeZone() var dateTime = NSDate.date() notification.fireDate(dateTime) notification.alertBody("Test") UIApplication.sharedApplication().scheduleLocalNotification(notification) For starters, I am not sure if this is the proper way to get the current date time. In .Net, I would just do