Questions tagged [usernotifications]

iOS 10, macOS 10.14, Mac Catalyst 13, tvOS 10 and watchOS 3 UserNotifications framework

The UserNotifications framework (UserNotifications.framework) supports the delivery and handling of local and remote notifications starting in iOS 10, macOS 10.14, Mac Catalyst 13, tvOS 10 and watchOS 3. Class names start with "UN". See https://developer.apple.com/reference/usernotifications.

182 questions
7
votes
2 answers

Swift3 Xcode 8: 'none' is unavailable: use [] to construct an empty option set ; What should I do?

I was using the UIUserNotificationType.none in Swift3 on ViewController.swift, and I got this error: 'none' is unavailable user[] to construct an empty option set ; Here is my code: func updateUI() { let currentSettings =…
krish
  • 159
  • 1
  • 12
7
votes
1 answer

Check notification type using UNNotificationSettings in iOS 10

How can I use UNNotificationSettings to get the notification type in iOS 10? On previous iOS, I would use this: UIUserNotificationSettings *notificationSettings = [[UIApplication sharedApplication] currentUserNotificationSettings]; Bool active =…
Mehul Chuahan
  • 752
  • 8
  • 19
6
votes
1 answer

WatchOS, SwiftUI: How to send local notifications with a 'View' as body

When creating the XCode project, I selected Apple Watch Application and enabled "Include Notification". This lead me to have a NotificationView.swift and a NotificationController.swift in my project. I have filled the NotificationView.swift with the…
Florian S
  • 552
  • 3
  • 15
6
votes
1 answer

Detect if app was launched by opening a local notification on iOS10+

I am currently migrating an app to the new UserNotifications framework. I'm stuck at detecting if the app was launched due to the user opening a local notification. The test case is: Schedule a local notification Manually close the app Setup Xcode…
AXE
  • 8,335
  • 6
  • 25
  • 32
6
votes
3 answers

Display image in notification bar with remote notification(Rich media push notification) in iOS 10

I have integrated APNS and want to display image in remote notification like below; I have used below code with reference link; AppDelegate.h #import @interface AppDelegate : UIResponder…
6
votes
2 answers

Cancel and reschedule UserNotification(old UILocalNotification) starting from custom date in iOS 10

I'm scheduling a daily UserNorification to trigger everyday at a specific time, notifying the user to do something. But if the user does that X hours before the notification is fired, I need to cancel today's notification, in my opinion cancel all,…
Slavcho
  • 2,792
  • 3
  • 30
  • 48
6
votes
3 answers

Local notifications are not firing in ios10

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 =…
Nazik
  • 8,696
  • 27
  • 77
  • 123
6
votes
3 answers

How to handle UNNotificationAction when app is closed?

How to handle new iOS10 Notification Action when app is closed (not in background) ? when app is minimalized everything works fine with: UNUserNotificationCenter.current().delegate = x and handling it in class x: UNUserNotificationCenterDelegate { …
5
votes
2 answers

Unable to update local scheduled notification content

In one of the WWDC sessions I got code snippet for updating existing notifications. I don't think it works. Trying to update notification content. First I request pending notifications from UNUserNotificationCenter which always works. Then I am…
Boris Y.
  • 4,387
  • 2
  • 32
  • 50
4
votes
1 answer

iOS 15 - Notification sounds are not playing for foreground notifications

What is the right way to play a tone associated with notification in iOS 15 without displaying banner or list? When handling notifications in foreground, both local and push, notification sounds are not playing if UNNotificationPresentationOptions…
return0
  • 93
  • 11
4
votes
1 answer

Is it correct to call registerForRemoteNotifications() all the time app starts?

From Apple Doc example on https://developer.apple.com/documentation/usernotifications/registering_your_app_with_apns UIApplication.shared.registerForRemoteNotifications() is called all the time when app starts: func application(_ application:…
user924
  • 8,146
  • 7
  • 57
  • 139
4
votes
0 answers

Notification Service Extension Creating Local Notifications

We want to add a feature to our app so that users are able to opt-in to being reminded to read important notifications which they might have missed. Here's how we would like it to work: When a push notification comes in, a Notification Service…
4
votes
3 answers

User notification are restricted to a limit in iOS app how to send unlimited for alarm app?

I am working on an alarm app project(Click for GitHub link) this code is working fine but the problem is notifications are limited to approximately 64 at the time so I am unable to send continues notification until the user responds to the…
Varun Naharia
  • 5,318
  • 10
  • 50
  • 84
4
votes
0 answers

iOS local notifications are missing action buttons

I'm just making my first app and I'm facing probably the biggest problem in it.I tried to make repeating local notifications with for loop each having different category but for some reason it doesn't work. I actually get all of the notifications…
4
votes
1 answer

Asking for Remote Notifications Authorization at another time in app's life cycle?

I'm running into a strange problem. When I request for remote notifications authorization inside the didFinishLaunchingWithOptions using the below code, I'm able to get a push remote notification from my server (Firebase Messaging) but when I try to…
Jad
  • 2,139
  • 1
  • 16
  • 28
1
2
3
12 13