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
3
votes
1 answer

UNUserNotificationCenter Swift - local notification not firing in specific cases

I'm facing issue while using Local Notifications in application. I'm scheduling local notification with custom content & custom action category. It's scheduling & firing in iOS 11, but not in iOS 10. As per documentation, it should be working in iOS…
3
votes
0 answers

UNUserNotificationCenter removeDeliveredNotificationRequests not removing notifications when created with UNCalendarNotificationTrigger

I am using the newer notification APIs introduced in iOS 10 and working in Swift. When I create a local notification, it shows up properly, but I am trying to remove it in my app when a relevant action occurs (so that the user doesn't have to clear…
3
votes
3 answers

Custom Local Notification Sound Not Working

I am trying to give custom notification sound for the local notification. But it still plays with default sound let content = UNMutableNotificationContent() content.title = NSString.localizedUserNotificationString(forKey: "Test",…
user6788419
  • 7,196
  • 1
  • 16
  • 28
3
votes
2 answers

How to turn on and off notifications in iOS?

I am trying to implement a settings screen in an iOS 11 app, where I need a UISwitch that would be used to control user notifications. When set on off, I want to give up the permissions to notifications, when set to on, I want to request for…
Milan Nosáľ
  • 19,169
  • 4
  • 55
  • 90
3
votes
2 answers

User Notification: Custom Vibration pattern

Is it possible to create custom vibration pattern for the user notification alert? example, we can choose to have different audio for the user notification. Is it possible to have custom vibration pattern as well? I mean do this programmatically on…
user6539552
  • 1,331
  • 2
  • 19
  • 39
3
votes
2 answers

Not able to import UserNotifications in iOS Swift

I'm trying to implement push notification by using Firebase. I have installed the 'Firebase/Core' and 'Firebase/Messaging' frameworks using cocapod. I'm able to import FirebaseInstanceID & FirebaseMessaging in the File. But for "import…
Aaliya
  • 85
  • 2
  • 10
3
votes
2 answers

Type of expression is ambiguous without more context in Swift 3

I am trying to learn Swift and am going through a tutorial on push notifications. let settings = UIUserNotificationSettings(forTypes: [.Alert, .Badge , .Sound], categories: nil) Is giving me the error "Type of expression is ambiguous without more…
George B
  • 2,592
  • 3
  • 22
  • 27
3
votes
1 answer

UNUserNotificationCenterDelegate delegate method "nearly matches optional requirement"

I am implementing func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: () -> Void) { But I'm getting the "nearly matches optional…
matt
  • 515,959
  • 87
  • 875
  • 1,141
2
votes
2 answers

Exclude notification methods for tvOS using @available

I'm studying UserNotifications framework and have the following method to respond to user's actions on a notification. func userNotificationCenter (_ pNotificationCenter: UNUserNotificationCenter, didReceive pResponse: UNNotificationResponse,…
NightFuryLxD
  • 847
  • 5
  • 15
2
votes
1 answer

Handling UserNotification when app is opened from the incoming notification

I've seen a lot a similar questions but I have not found an answer to this specific scenario while running on Mac. If the app is off and a user notification comes in and the user taps on it, then the app is opened. Once the app is opened, how can…
2
votes
0 answers

UserNotification repeat every minute starting at date in the future

Using Swift5.2, iOS13.4, I try to set a local Notification that fires on a particular date and repeats every minute endlessly. I tried using Calendar.components and UserNotification in the following way: // create alarmDate in the future let…
iKK
  • 6,394
  • 10
  • 58
  • 131
2
votes
1 answer

iOS: how to run code in background when app is closed?

Using Swift5.2, iOS13.4, I try to run code in the background (when app is fully closed) at a particular date. Local Notifications work great if App is foreground (or if user-interaction then also in background). Some people say (here or here, that…
iKK
  • 6,394
  • 10
  • 58
  • 131
2
votes
2 answers

How to set up daily local notification for tasks but don't show it when user completes the task before

I know similar questions appeared before but I think I need more clarification since i still don't know how to make it done. I'm a beginner programmer so please forgive me any mistakes. I'm trying to have daily reminders for daily tasks from my app…
dakota
  • 293
  • 3
  • 13
2
votes
0 answers

UNUserNotifications method `requestAuthorization` doesn't show dialogue on macOS Catalyst

We are successfully using the Push Notifications in various builds, but on Mac Catalyst UNUserNotificationCenter.current().requestAuthorization doesn't show popup so as a result the user doesn't know that notifications should be turned on if he…
2
votes
1 answer

Sync notifications across the iCloud devices

Built-in iOS Reminders app allows us to create to-do lists with their own reminders (notifications). And all of the lists, and reminders are can easily sync across the iCloud devices. Once synced the iCloud devices can easily send (location and…
Mannopson
  • 2,634
  • 1
  • 16
  • 32