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
0
votes
2 answers

Handle IOS remote notifications if the app is forced quit

I handling the remote notification like the code snippet shown below, but I failed to launch the app and redirect to specific pages when the users force quite the app. func userNotificationCenter(_ center: UNUserNotificationCenter, …
kiki
  • 41
  • 1
  • 10
0
votes
0 answers

UNUserNotificationCenter did receive response with completion handler is never called iOS11, objective-C

Occasionally one of my users reports that he does not receive a sound or banner that should be posted when (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response…
Nelson Capes
  • 411
  • 3
  • 12
0
votes
1 answer

How to schedule a notification that will repeat with some frequency after specific time passes

I don't see support for scheduling such kind of notification i.e. that repeats only when a specific time passes. The problem is that the schedule fires immediately without waiting for the exact time although repeats correctly. e.g. here is the code…
0
votes
2 answers

Local Notifications Identifiers

I have the following code for the request and posting the notification: let request = UNNotificationRequest(identifier: "timerDone", content: content, trigger: trigger) UNUserNotificationCenter.current().add(request, withCompletionHandler:…
D-A UK
  • 1,084
  • 2
  • 11
  • 24
0
votes
0 answers

Swift after removing an user notification, I need an deli that the pending notifications are updated

If I removed a user notification and I will update my TableView with the list of pending notifications, the removed notification is still in the list. I printed the array of notifications and it is still in the array. But if I make a minimum 3ms…
Fabio M.
  • 51
  • 8
0
votes
1 answer

Schedule a local notification(silent) to perform a custom task in background + swift ios

In our app, the user will clock-in when he starts his work. If the user forgets to clock-out, we will have to automatically clock him out after 24 hours from the clock-in time. The app might not be in the active/background state for such a long…
0
votes
1 answer

Swift: Get content from UNTextInputNotificationAction in AppDelegate

I'm using Xcode 9.4.1 (9F2000) and Swift. I have this code in AppDelegate: func showPushButtons(){ let replyAction = UNTextInputNotificationAction( identifier: "reply.action", title: "Reply to message", …
David
  • 2,898
  • 3
  • 21
  • 57
0
votes
2 answers

Swift: Write in textfield when clicking on push notification action button and handle it

I'm using Xcode 9.4.1 (9F2000) and Swift. I have this code in AppDelegate: func showPushButtons(){ let replyAction = UNNotificationAction( identifier: "reply.action", title: "Reply to this message", options: []) let…
David
  • 2,898
  • 3
  • 21
  • 57
0
votes
1 answer

Swift; HTTP request from UNUserNotificationCenter not working: The Internet connection appears to be offline

I'm using Xcode Version 9.4.1 (9F2000). I have this code in AppDelegate.swift: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { …
David
  • 2,898
  • 3
  • 21
  • 57
0
votes
1 answer

authorizationStatus return a bool value

I wasn't sure if this is possible. I would like to have a bool returned from authorizationStatus when i called UNUserNotificationCenter.current().getNotificationSettings() I first created a callback block to determine authorizationStatus then the…
Desmond
  • 5,001
  • 14
  • 56
  • 115
0
votes
0 answers

I'm not getting Remote Notification data after Local Notification is showed

In my application i'hv implemented both local and remote notification, both are working fine. I'hv implement local notification from this Link same code. Now, My App is in Foreground mode and i'm firing push notification,…
Pratik Prajapati
  • 1,137
  • 1
  • 13
  • 26
0
votes
1 answer

How to schedule Notifications in Swift

I am trying to schedule notifications in my project. I don't get any errors or runtime crashes, however for some reason I don't get any notifications on the simulator when scheduling. I am not sure where exactly I am going wrong, as I have been…
RileyDev
  • 2,950
  • 3
  • 26
  • 61
0
votes
1 answer

How to schedule the local notification

I am working on smoking quit application. I want to show local notification to user who are achieve there goals without smoking for period of time. 20 min, 12 hour, 24 hour, 1 Week, 4 week, 2 months, 5 months, 1 year, 5 year, 10 year, 20 year. I…
kiran
  • 4,285
  • 7
  • 53
  • 98
0
votes
1 answer

Delay a repeated User Notification on iOS

When scheduling a User Notification on iOS, is there a way to add an initial delay to the UNCalendarNotificationTrigger when performing the date matching? For example: in 3 days from now, begin sending the local notification once a day. The reason…
Daniel Larsson
  • 6,278
  • 5
  • 44
  • 82
0
votes
1 answer

Can I use iOS local notifications if app is not running (like Clock app)?

I'd like to use iOS local UNNotifications even if my app is not running. The same way we use Alarm in Clock app. We can setup Alarm, then quit our Clock app but... sound and notification will run on time. I need the same type of behaviour. Is it…