uilocalnotification

UILocalNotification isn't working at all

倾然丶 夕夏残阳落幕 提交于 2019-11-28 07:33:18
I'm having some really irritating problems with UILocalNotification . While finishing up an app that I've nearly completed, I noticed that I couldn't get local notifications to work, no matter what I tried. So instead of wasting time, I decided to go back to basics and see if I could get them working at all. I created a new XCode view-based application, and replaced -viewDidLoad with this: - (void)viewDidLoad { UILocalNotification * theNotification = [[UILocalNotification alloc] init]; theNotification.alertBody = @"Alert text"; theNotification.alertAction = @"Ok"; theNotification.fireDate =

Local Notification in background

旧街凉风 提交于 2019-11-28 07:02:01
Can anyone please tell me how to get a UILocalNotification while my app is in the background. I am posting my code here. Thanks in advance. UILocalNotification *localNotif = [[UILocalNotification alloc] init]; if (localNotif == nil) return; localNotif.fireDate =[startDate addTimeInterval:60]; NSLog(@"%@",localNotif.fireDate); localNotif.timeZone = [NSTimeZone defaultTimeZone]; localNotif.alertAction = @"View"; localNotif.soundName = UILocalNotificationDefaultSoundName; NSString *notifStr=[NSString stringWithFormat:@"Hey looks like you're meeting up with %@, why don't you let your other friends

Schedule number of Local Notifications

风格不统一 提交于 2019-11-28 06:34:46
I am making an iPhone application in which I have implemented the concept of local notification to alert the user for taking medicine. But in iOS we can't schedule more than 64 notifications at a time. But I have a number of date-time entries in the database. How could I schedule more than 64 notifications? I've created app with local notifications and in this case user was notified every 20/40/60 minutes in given time interval (eg. 8:00-20:00). The solution was to generate up to 64 notification through whole day and set repeatInterval of UILocalNotification to NSCalendarUnitDay. Of course if

How I can set a notification which UserNotifications Framework

瘦欲@ 提交于 2019-11-28 06:10:34
问题 I can set a notification in a time interval but I don't know how make it in a specific time and date, I try this but don't work let center = UNUserNotificationCenter.current() func notificationSender(){ center.requestAuthorization([.sound, .alert]) { (granted, error) in // We can register for remote notifications here too! } var date = DateComponents() date.hour = 13 date.minute = 57 let trigger = UNCalendarNotificationTrigger.init(dateMatching: date , repeats: false) let content =

Understanding UILocalNotification timeZone

泄露秘密 提交于 2019-11-28 04:44:25
From the docs: The date specified in fireDate is interpreted according to the value of this property. If you specify nil (the default), the fire date is interpreted as an absolute GMT time, which is suitable for cases such as countdown timers. If you assign a valid NSTimeZone object to this property, the fire date is interpreted as a wall-clock time that is automatically adjusted when there are changes in time zones; an example suitable for this case is an an alarm clock. Suppose I schedule an local notification for (in absolute time) noon tomorrow GMT. I schedule this in Seattle at 1PM

Alarm clock app in iOS

◇◆丶佛笑我妖孽 提交于 2019-11-28 04:44:20
I have to create an alarm clock app for the iPhone in which user can set alarm time and sound. In doing so, I have used UILocalNotification to set off the alarm. Now, in UILocalNotification, first we get Notification Alert with option "Close" and "View". If the user taps on "View", then my delegate receives the application:didReceiveLocalNotification: message and the alarm sound plays. But in the system-native alarm app, we don't see a notification alert; it just directly plays the alarm sound. How can I have my app use this behavior? I agree with David. iOS built-in alarm app gets a special

Scheduling local notifications to repeat daily from tomorrow in Swift

喜你入骨 提交于 2019-11-28 04:07:08
问题 I'm trying to schedule a local notification to fire every day (i.e. repeats), at a specific time, but from tomorrow. i.e "Trigger a notifcation every day at 8pm, from tomorrow" I've been using this SO question as guidance, and I believe I am doing what it says but I am still getting a notification today when I run the following code (if I schedule the notification before 8pm for instance): func testDateNotification(){ let content = UNMutableNotificationContent() content.title = "Test" content

UNUserNotificationCenter removeAllDeliveredNotifications not working in ios 11.2

我只是一个虾纸丫 提交于 2019-11-28 03:01:39
问题 I have an app with multiple local notifications. When I try to clear all the delivered notifications, I call this removeAllDeliveredNotifications method. It's working fine till ios 11.1 . In ios 11.2 and above, it doesn't work as expected. The notification still remains in the notification center. Could someone please help me out on this. Thanks in advance. 回答1: It is still working for us. I just checked it on iOS 11.2.2. I am using removeDeliveredNotificationsWithIdentifiers: inside

Difference between NSCalendarUnitWeekOfYear & NSCalendarUnitWeekOfMonth

孤街醉人 提交于 2019-11-28 02:55:59
问题 I want to make a UILocalNotification repeat every week, before iOS7 I would use localNotification.repeatInterval = NSWeekCalendarUnit - except NSWeekCalendarUnit has been deprecated. The docs say: "Use NSCalendarUnitWeekOfMonth or NSCalendarUnitWeekOfYear, depending on which you mean" But I don't know what the difference is, so I don't know which one I mean. 回答1: These don't appear to be documented but most likely NSCalendarUnitWeekOfYear will be a value from 1-53 (or maybe 0-52) representing

UILocalNotification does not fire after 10 minutes in background

醉酒当歌 提交于 2019-11-28 02:25:44
问题 I have a VoIP application. Which is working fine. Call is working in foreground and background. Following steps are done: UIBackgroundModes => voip in Info.plist Configured one of the app’s sockets for VoIP usage. Before moving to the background, setKeepAliveTimeout:handler: is called Configured audio session to handle transitions to and from active use. To ensure a better user experience on iPhone, used the Core Telephony framework to adjust behavior in relation to cell-based phone calls; To