usernotifications

Multiple UNUserNotifications not firing

本小妞迷上赌 提交于 2019-11-28 01:24:59
I'm setting multiple UNUsernotifications as below, - (void)viewDidLoad { [super viewDidLoad]; notifCount = 0; UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) { if (!error) { NSLog(@"request succeeded!"); [self set10Notif]; } }]; } In the set10Notif method, I'm setting multiple(8 for testing) notifications with time 10 seconds from current time. -(void) set10Notif {

didReceiveLocalNotification not getting called after using UNUserNotificationCenter

我的未来我决定 提交于 2019-11-28 00:28:52
问题 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? 回答1: As you know, iOS 10 introduced the UNUserNotifications framework to handle both local and remote notifications. Using

How can I skip the first occurrence of a repeating UNCalendarNotificationTrigger?

橙三吉。 提交于 2019-11-27 23:41:11
问题 Say today is a Monday and it's 1 PM. I want to schedule a weekly local notification from my iOS app starting today at 2 PM. I'd do this: NSDateComponents *components = [[[NSDateComponents alloc]init]autorelease]; components.weekday = 2; components.hour = 14; components.minute = 0; UNCalendarNotificationTrigger *trigger = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:components repeats:YES]; //then make a UNMutableNotificationContent and UNNotificationRequest and schedule it

Alternative to UserNotificationCenterDelegate's willPresent when app is in background

南楼画角 提交于 2019-11-27 09:37:20
I am trying to figure out whether I can accomplish my goal through Local Notifications, or whether I need to switch to Remote Notifications. I'm practicing iOS 10 / Swift 3 by building an alarm program that plays the latest episode of a RSS-updated radio show at a set time of day. When the app is in the foreground, this is easy to execute through UNUserNotificationCenterDelegate's willPresent function. I just use willPresent to fetch the latest episode, and play it through an AVAudio Player. Of course, if the app only works in the foreground, this functionality is very limited. I would want

How to schedule a local notification in iOS 10 (objective-c) [closed]

假装没事ソ 提交于 2019-11-27 07:54:57
I'd like to schedule local notifications using iOS 10. I'd like to know how to do this. I've looked all around the web, but I keep finding clues only for registering and handeling the notifications. Not for the scheduling of a local notification. So, does anyone know how to do this? Try it. Its deprecated but working code. Use it for Before iOS 10.0 : //Get all previous noti.. NSLog(@"scheduled notifications: --%@----", [[UIApplication sharedApplication] scheduledLocalNotifications]); NSDate *now = [NSDate date]; now = [now dateByAddingTimeInterval:60*60*24*7]; //7 for 7th day of the week.

Enable or Disable Iphone Push Notifications inside the app

南笙酒味 提交于 2019-11-27 07:16:51
I have a iphone app which is enable to receive push notifications. Currently i can disable push notifications for my app by going to the iphone settings/Notifications. But i want to add a switch or button inside my app to enable or disable push notifications. It can be done because i saw it in foursqure iphone app did it. They got a section in settings call notification settings and user can enable or disable different kind of notification for the app. I look all over the net to find a proper solution for this but still not found a way. Can any one please give any idea how to do that ? Thanks

iOS 10: How to show incoming VOIP call notification when app is in background?

╄→гoц情女王★ 提交于 2019-11-26 21:56:28
问题 I'm working on audio/video call and trying to get incoming call notification loop for 1 minute like WhatsApp shows in iOS when app is background, Notification banner hide and show with ringtone for 1 minute. I have tried this code, it triggers only single time: UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init]; content.title = [NSString stringWithFormat:@"Video Call from %@",userId]; content.body = @""; content.userInfo = [userInfo mutableCopy]; content.sound

Why only my last local notification function is getting called?

℡╲_俬逩灬. 提交于 2019-11-26 21:56:11
问题 I'm fairly new to swift and am trying to call multiple functions that request a local notification inside a UISwitch IBAction. I want to send a notification on a certain date - each quarter of the year on months 4, 7, 10, 1. Only the fourth quarter function is getting called. How can I get all four functions to be called? Here is my code: // UISwitch for quarterly notifications @IBAction func quarterlyFrequencyTapped(_ sender: UISwitch) { if quarterlyFrequency.isOn == true { firstQuarter();

Alternative to UserNotificationCenterDelegate's willPresent when app is in background

走远了吗. 提交于 2019-11-26 14:49:16
问题 I am trying to figure out whether I can accomplish my goal through Local Notifications, or whether I need to switch to Remote Notifications. I'm practicing iOS 10 / Swift 3 by building an alarm program that plays the latest episode of a RSS-updated radio show at a set time of day. When the app is in the foreground, this is easy to execute through UNUserNotificationCenterDelegate's willPresent function. I just use willPresent to fetch the latest episode, and play it through an AVAudio Player.

How to schedule a local notification in iOS 10 (objective-c) [closed]

倾然丶 夕夏残阳落幕 提交于 2019-11-26 13:54:25
问题 I'd like to schedule local notifications using iOS 10. I'd like to know how to do this. I've looked all around the web, but I keep finding clues only for registering and handeling the notifications. Not for the scheduling of a local notification. So, does anyone know how to do this? 回答1: Try it. Its deprecated but working code. Use it for Before iOS 10.0 : //Get all previous noti.. NSLog(@"scheduled notifications: --%@----", [[UIApplication sharedApplication] scheduledLocalNotifications]);