unusernotificationcenter

How do I respond to a tap on a UNUserNotification?

一笑奈何 提交于 2019-12-01 09:40:31
I'm using the new UNUserNotification framework in iOS 10. I can see how to add action buttons, but how do I respond when the user taps the notification itself? In my case, it will be an image with some text. The default behavior is that the application opens. Can I have custom code that detects if my application is being opened because of a UNUserNotification tap, and ideally with identifier information about the notification tapped? Will these work if my app is running in the background or closed? UNUserNotification documentation suggests setting the delegate of UNUserNotificationCenter , but

How do I respond to a tap on a UNUserNotification?

♀尐吖头ヾ 提交于 2019-12-01 07:35:12
问题 I'm using the new UNUserNotification framework in iOS 10. I can see how to add action buttons, but how do I respond when the user taps the notification itself? In my case, it will be an image with some text. The default behavior is that the application opens. Can I have custom code that detects if my application is being opened because of a UNUserNotification tap, and ideally with identifier information about the notification tapped? Will these work if my app is running in the background or

Local notifications are not firing in ios10

只愿长相守 提交于 2019-12-01 02:28:34
问题 I'm using UNUserNotificationCenter for ios 10. For testing, I'm setting a local notification for 10 seconds from current time. This is what I tried, - (void)viewDidLoad { [super viewDidLoad]; UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) { if (!error) { NSLog(@

Springboard crashing when adding a lot of triggers to UNUserNotificationCenter

烂漫一生 提交于 2019-11-30 09:59:12
Save yourselves from hours of debugging, because I've just wasted 2 weeks after bug hunting mysterious app crashes. It turns out, if you're adding a lot o (see answer for more details) notification requests to the UNUserNotificationCenter , it will abruptly crash the Springboard. I haven't found a way around this yet, as the same code worked fine for iOS 9 and below. You can't seem to bulk-add notification requests like before either. Following is the crash I receive every single time (and so does hundreds of app users). Any idea what I could do instead of going back to using

How to enable/disable push notification from the app?

无人久伴 提交于 2019-11-29 19:34:19
In my app I want to enable/disable push notification from the settings page of my app itself.Can any one suggest me a solution to turn on/off the status of app in notification center from the app ? you can register and unregister the remote notification with bellow code. Register RemoteNotification with bellow code..means Enable notification //-- Set Notification if ([[UIApplication sharedApplication]respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) { // For iOS 8 and above [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings

Springboard crashing when adding a lot of triggers to UNUserNotificationCenter

半腔热情 提交于 2019-11-29 15:21:01
问题 Save yourselves from hours of debugging, because I've just wasted 2 weeks after bug hunting mysterious app crashes. It turns out, if you're adding a lot o (see answer for more details) notification requests to the UNUserNotificationCenter , it will abruptly crash the Springboard. I haven't found a way around this yet, as the same code worked fine for iOS 9 and below. You can't seem to bulk-add notification requests like before either. Following is the crash I receive every single time (and so

How can I remove previously delivered notifications when a new notification arrives with UNUserNotificationCenterDelegate in iOS 10?

时光怂恿深爱的人放手 提交于 2019-11-29 06:22:09
This question is about the new UserNotifications framework in iOS 10. I have an app that schedules a local notification every half hour after the user did a certain action in the app, starting at 1 hour. To avoid cluttering a user's lock screen or notification center, I only want one notification to show up at a time, so there is only one notification with the most recent, relevant information. My plan to achieve this is to clear all delivered notifications any time a new notification is presented. It seems this should be possible with the new willPresent method of

How to enable/disable push notification from the app?

时间秒杀一切 提交于 2019-11-28 15:09:14
问题 In my app I want to enable/disable push notification from the settings page of my app itself.Can any one suggest me a solution to turn on/off the status of app in notification center from the app ? 回答1: you can register and unregister the remote notification with bellow code. Register RemoteNotification with bellow code..means Enable notification //-- Set Notification if ([[UIApplication sharedApplication]respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) { // For iOS 8 and

iOS local notification not firing second time but shows in getpendingnotificationrequests

有些话、适合烂在心里 提交于 2019-11-28 12:08:26
问题 I have implemented iOS 10 local notification where it works for the first alarm but not for other. I have import iOS 10 library , implemented delegate , receiving it first time in the delegate but it just not firing later. My date formate looks like : 2017-05-28 14:04:07 +0000 NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; [calendar setTimeZone:[NSTimeZone localTimeZone]]; //(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay |

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 {