Questions tagged [unusernotificationcenter]

Manages the notification-related activities for your app or app extension. Local notifications and push notifications are both ways for an iOS application that isn’t running in the foreground to let its users know it has something for them. Use this tag for the queries related to the new Rich Notifications introduced in Swift 3.

Use the shared UNUserNotificationCenter object to schedule notifications and manage notification-related behaviors in your app or app extension. The shared user notification center object supports both local or remote notifications in varying capacities. Use this object to perform the following types of tasks:

  • Request authorization for displaying alerts, playing sounds, or badging the app’s icon in response to local or remote notifications. (Authorization is required for all user interactions.)

  • Declare the notification types that your app supports and the custom actions (if any) that the user may perform when those notifications
    are delivered.

  • Schedule the delivery of notifications from your app.

  • Manage app-specific notifications displayed in Notification Center.

  • Get the notification-related settings for your app.

The notifications that you schedule directly from your app are known as local notifications because your app creates them locally on the user’s device. By contrast, remote notifications are created by your own server and delivered to the user’s device via the Apple Push Notification Service (APNS).

370 questions
4
votes
2 answers

Switch to enable/disable local notifications (swift 4)

I am making a Todo app and there supposed to be a switch button in inside of an application settings to enable/disable all local notifications. I tried removeAllPendingNotificationRequests() method, but it deletes all notifications altogether and i…
4
votes
1 answer

Adding Dynamic Actions to UNNotificationCategory

I am currently facing an issue where I need to be able to change the actions of a UNNotificationCategory based on information sent with the notification. Currently my categories are set up similarly to this: func registerNotificationSettings(){ …
4
votes
3 answers

How to detect if user has taken action local notification or remote notification?

I am displaying local and remote notifications in my app. Now there is scenario if the notification is local then I want to take a different action or if the the notification is remote then I want to take some different action. Till iOS 9 I was…
TechChain
  • 8,404
  • 29
  • 103
  • 228
4
votes
0 answers

Scheduling repeating local notification in the future

Is it possible to schedule a repeating local notification in the future? I'm trying to set up a repeating notification every 10 min starting in 30 min for example. (iOS 11 Swift) I've tried using UNTimeIntervalNotificationTrigger but I'm not sure…
4
votes
2 answers

How to repeat a UNUserNotification every day?

I'm trying to allow the user to schedule notifications to open the app at a certain time every day. So far, I've been able to schedule the first notification by calculating the time between now and when the user selects, and scheduling a…
Spencer Milanak
  • 123
  • 2
  • 10
4
votes
4 answers

Why is my local notifications not triggered in the foreground in iOS 10?

I'm trying to understand why the local notifications is not being displayed in the foreground. I believe I added all the correct code to allow this ability but no banner is showing when my app is in the foreground. Here's what I added in…
Pangu
  • 3,721
  • 11
  • 53
  • 120
4
votes
0 answers

removeAllDeliveredNotifications doesn't work

RemoveAllDeliveredNotifications doesn't remove notification when from the settings notification type is banner. UNUserNotificationCenter * center = [UNUserNotificationCenter currentNotificationCenter]; [center removeAllDeliveredNotifications];
4
votes
2 answers

Multiple UNUserNotifications not firing

I'm setting multiple UNUsernotifications as below, - (void)viewDidLoad { [super viewDidLoad]; notifCount = 0; UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center…
Nazik
  • 8,696
  • 27
  • 77
  • 123
3
votes
1 answer

Local notification not presenting when app is in background in Xamarin iOS

I have implemented chat functionality in my Xamarin.IOS app, as remote notifications are not possible to send from the server-side, I am using local notification to alert the user of new incoming messages. Everything works fine in the simulator, I…
3
votes
2 answers

UNNotificationSound doesn't play on macOS. Same file works on iOS

Been pulling my hair for the past week. What I've learned: Notification sound works on iOS, not macOS Files on ~/Library/Sound (notice the tilde, it's outside the project folder): Some (not all) file played with .m4r and .aiff format fired the…
Philip Young
  • 341
  • 1
  • 3
  • 8
3
votes
0 answers

How to get notified when user changes push notification settings in the Settings app?

Consider the following scenario: App Installed App Starts Push Notification ➝ Request Push Notification ➝ Don't Allow App Closed or in Background Settings ➝ User enabled Push Notification How to get notified of this change without moving the…
Stoyan
  • 1,265
  • 11
  • 20
3
votes
2 answers

UNUserNotificationCenter. Notifications are not allowed for this application

I noob in development application on OSX. I want to create app with Share extension. After content loading I want to show Notification, but I getting error "Notifications are not allowed for this application". I don't understand why…
3
votes
1 answer

What does completionHandler in userNotificationCenter actually do?

I'm currently implementing push notifications and I was wondering, what does completionHandler in userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: actually do? Apple's documentation says: The block to execute when you…
3
votes
1 answer

Ios UNUserNotification Content Attachement (Image) resize/hide on notification expansion (Long click)

I have an app which shows local notification with content attachment as below image: Now when i click to show the notification actions button, the image gets enlarged and thus my image gets blurred. I tried to find the ways to show the action…
3
votes
1 answer

Swift Repeat LocalNotification every 5 days

How to repeat LocalNotification every 5 days at 10:00 AM I try this, but it's not working let content = UNMutableNotificationContent() content.title = "Hello!" content.body = "Hello_message_body" content.sound = UNNotificationSound.default() let…
Almudhafar
  • 887
  • 1
  • 12
  • 26