uilocalnotification

UILocalNotification does not fire after 10 minutes in background

六月ゝ 毕业季﹏ 提交于 2019-11-29 08:56:33
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 ensure good performance for VoIP app, used the System Configuration framework to detect network

iOS Daily Local Push Notifications

梦想与她 提交于 2019-11-29 07:33:48
I want to execute a UILocalNotification at 9:00 AM every day, forever, as long as the app is open. The closest thing I've found is this: UILocalNotification *notification = [[UILocalNotification alloc] init]; notification.fireDate = [[NSDate date] dateByAddingTimeInterval:60*60*24]; notification.alertBody = @"It's been 24 hours."; [[UIApplication sharedApplication] scheduleLocalNotification:notification]; However, this code only executes a UILocalNotification once in 24 hours, not at a specified time. I've been looking into utilizing NSDate somehow, but have been getting no where. The code

didReceiveLocalNotification not getting called after using UNUserNotificationCenter

可紊 提交于 2019-11-29 06:56:58
I am scheduling local notifications. It works in iOS 9.x but since iOS 10 -(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification doesn't get called when app is running on iOS 10. I know that iOS has introduced new UserNotifications framework but that shouldn't stop working iOS 9 APIs. How can I resolve this issue? As you know, iOS 10 introduced the UNUserNotifications framework to handle both local and remote notifications. Using this framework, you can set a delegate to detect when a notification is presented or tapped.

IOS 本地通知 UILocalNotification 游戏示例

こ雲淡風輕ζ 提交于 2019-11-29 05:25:53
【本文章第四部分中的代码逻辑来自网上的借鉴,并非我自己原创】 大概一个月前,我开始跟着做IOS项目了。学习C++,了解Objective-C,等等。这两天做了游戏的本地通知,当然是从网上查了很多资料。 但资料有很多的偏差,不过最终还是解决了问题,很幸运。所以总结了一下下。 用到的重点就是Objective-C 的UILocalNotification对象。其实加入通知的代码很简单,但重要的是你要理顺Notification的逻辑。 首先我要声明的是我的开发环境: 首先在windows下面用Visual studio开发,调试,编译通过了以后。再在Mac下面用Xcode编译,导到Ipad4上面运行的。所以我的混编文件是Objective-C和C++的混合。 1 UILocalNotification *notification=[[UILocalNotification alloc] init]; 2 if (notification!=nil) { 3 NSDate *now = [NSDate date]; 4 //从现在开始,10秒以后通知 5 notification.fireDate=[now dateByAddingTimeInterval:10]; 6 //使用本地时区 7 notification.timeZone=[NSTimeZone

Repeating a Local Notification after every 14 days(two weeks)?

☆樱花仙子☆ 提交于 2019-11-29 04:35:10
In my app i've to set repetitive UILocalNotification . I'm able to set repeatInterval as daily, weekly etc by doing UILocalNotification *localNotification = [[UILocalNotification alloc] init]; localNotification.repeatInterval = NSDayCalendarUnit; // or any other calendarUnit Ok..it's fine, but i've to set repeatInterval for every 14 days. i came to know from this link that we can only use one of the NSCalendarUnit repeat intervals. So you can have a repeat interval of one minute or one hour or one day but not five minutes or three hours or 14 days. Any Idea about this limitation in iOS 5 or

Removing UILocalNotification from notification tray programmatically

主宰稳场 提交于 2019-11-29 02:47:48
问题 Is there a way to programmatically remove/dismiss UILocalNotification from Notification Tray. I am able to cancel the notification which removes the notifications from [[UIApplication sharedApplication] scheduledLocalNotifications] Here is what i need to do I need to dismiss the UILocalNotification from NotificationTray after the action has been performed(ie after the user taps the notification) EDIT: I can remove the notifications from the NSNotificationCenter . I want to remove specific

How can I add action buttons/actions to UILocalNotification alert?

不想你离开。 提交于 2019-11-29 02:33:40
I have a local notification scheduled in my app, and right now I get a generic cancel (cross) button as I swipe the alert to the left. I'm curious if I can add custom buttons/actions to it like on the image below? I prepared for you some snipped code which shows notification with one button 10 second after ViewDidLoad method did shown. import UIKit class TestViewController: UIViewController { let category = UIMutableUserNotificationCategory() override func viewDidLoad() { super.viewDidLoad() let restartAction = UIMutableUserNotificationAction() restartAction.identifier = "xx" restartAction

How to repeat local notifications every day at different times

浪子不回头ぞ 提交于 2019-11-29 01:39:03
问题 I'm working on a prayers application that enables users to set an alarm(local notification) for prayer times, i.e. the user sets the application to notify him for Fajr prayer every day, the problem is that the time for each prayer changes daily so the time the app will notify the user for fair in thursday will differ from the time in friday, i need to repeat the local notification every day but according to the daily prayer time, please, could anyone give me an idea? 回答1: There are a few

How to set repeat frequency in User Notification [duplicate]

你离开我真会死。 提交于 2019-11-28 21:39:43
This question already has an answer here: How do I set an NSCalendarUnitMinute repeatInterval on iOS 10 UserNotifications? 3 answers Till iOS 9 we write local notifications like this UILocalNotification* localNotification = [[UILocalNotification alloc] init]; localNotification.fireDate = pickerDate; localNotification.alertBody = self.textField.text; localNotification.timeZone = [NSTimeZone defaultTimeZone]; localNotification.repeatInterval = NSCalendarUnitMinute; localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1; [[UIApplication

Scheduling local notification from within a Today extension

£可爱£侵袭症+ 提交于 2019-11-28 21:35:43
I'm making an app that contains a Today Extension. The today extension displays a list of timers, and if the user selects one of the timers, I'd like to create and schedule a local notification for that timer. My problem is that scheduling of notifications is done with this line of code: UIApplication.sharedApplication().scheduleLocalNotification(notification) which very unfortunately relies on UIApplication.sharedApplication() that is not accessible from an extension. So my question is: How can I schedule a local notification from within a Today extension? Funnily enough, I can make a