unusernotificationcenter

UNCalendarNotificationTrigger - Execute after the hour

青春壹個敷衍的年華 提交于 2019-12-12 04:34:39
问题 Good Morning Sirs I know using UNCalendarNotificationTrigger this way: var dateComponents = DateComponents() dateComponents.hour = 10 dateComponents.minute = 30 let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true) Every day at 10:30 a notice will be delivered. My question is whether the user opens the applications or calls after that time, if the notification will be delivered anyway. 回答1: Local notifications, once created and scheduled, have nothing to do

local notification not appearing (Swift4)

无人久伴 提交于 2019-12-11 16:57:02
问题 My code below is supposed to act as an alarm clock. When the date and time matches nothing is happening but I am seeing my print in the log file. Please try this code and test what I am doing it wrong. It seemed liked it worked before. This is supposed to still go off in the background if the user is not using the app. import UIKit;import AVFoundation;import UserNotifications class ViewController: UIViewController, UNUserNotificationCenterDelegate {var timer = Timer();var isGrantedAccess =

Swift - Local notification icon badge number update on deliver App is in background

本小妞迷上赌 提交于 2019-12-11 04:54:33
问题 I am trying to figure how I can update dynamically the icon badge number when a local notification is delivered. Registering the badge number upon scheduling is not an option since if I register two or more notification before any are delivered the UIApplication.shared.applicationIconBadgeNumber // this will be zero will always be zero until a notification is delivered. I can use the UNUsernotification delegate with the func func userNotificationCenter(_ center: UNUserNotificationCenter,

Notification Center and changing timezones

点点圈 提交于 2019-12-11 04:03:29
问题 Swift 4 & >iOS 10.0 I want to schedule a local notification at a certain date and at a given time (let's say 3PM). I want the notifications to always be fired at 3PM, whatever the timezone I am in (automatic rescheduling of notifications according to timezones). Previously, you could tweak UILocalNotifications ' time zone to achieve exactly this, like perfectly explained in this SO post. However, in >iOS 10.0 , UILocalNotifications is deprecated. Here is my code: func scheduleNotification

Wait till local notifications from UNUserNotificationCenter gets deleted using removePendingNotificationRequests ios 10 swift 3

别来无恙 提交于 2019-12-10 10:28:07
问题 Using new local notifications from UNUserNotificationCenter . I try to delete notification with some identifiers: UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: identifiers) and from documention: This method executes asynchronously, removing the pending notification requests on a secondary thread. Completion handler is not present. So how do I know when its really get deleted? Before moving ahead, I need to make sure that this identifier is not present

UNUserNotificationCenter Swift - Local Notification Not Firing in specific cases

微笑、不失礼 提交于 2019-12-06 05:55:50
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 worked in iOS 10 as well. Please review my code, and let me why it's not working in such specific cases. Code is below. AppDelegate.swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { ....... if #available(iOS 10.0, *) { UNUserNotificationCenter.current().delegate =

Wait till local notifications from UNUserNotificationCenter gets deleted using removePendingNotificationRequests ios 10 swift 3

╄→гoц情女王★ 提交于 2019-12-05 19:00:54
Using new local notifications from UNUserNotificationCenter . I try to delete notification with some identifiers: UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: identifiers) and from documention: This method executes asynchronously, removing the pending notification requests on a secondary thread. Completion handler is not present. So how do I know when its really get deleted? Before moving ahead, I need to make sure that this identifier is not present anymore. I know I can use next code notificationCenter.getPendingNotificationRequests { (requests) in

User Notification request always come with default action identifier

感情迁移 提交于 2019-12-04 04:21:11
I am using the UNUserNotificationCenterDelegate (> ios 10) and one of the delegate methods where I can check the response from the notification has always actionIdentifier equal "com.apple.UNNotificationDefaultActionIdentifier" no matter what I do. The "response.notification.request.content.categoryIdentifier" comes right, with the expected value, but the request.actionIdentifier never comes correctly ("mycustomactionidentifier" in the example below). Does anyone know if I'm missing something? extension NotificationManager: UNUserNotificationCenterDelegate { func userNotificationCenter(_

iOS 11 crashing with bundleProxy != nil error on using UNUserNotificationCenter

心不动则不痛 提交于 2019-12-03 12:38:55
The following line of code is where our app has suddenly started to crash on iOS 11 / 11.0.1 / 11.0.2 / 11.1.1 / 11.2.2 for some users: UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; We've got this in didFinishLaunchingWithOptions . The crash report says: Fatal Exception: NSInternalInconsistencyException Invalid parameter not satisfying: bundleProxy != nil Fatal Exception: NSInternalInconsistencyException 0 CoreFoundation 0x1869b3d38 __exceptionPreprocess 1 libobjc.A.dylib 0x185ec8528 objc_exception_throw 2 CoreFoundation 0x1869b3c0c +[NSException

How to change how a remote notification is presented before presentation?

馋奶兔 提交于 2019-12-01 14:00:01
问题 How should I change how a remote notification is presented in iOS before the system presents it? In fact, silence it. There are times where my app has canceled a Firebase topic subscription locally, but that cancellation is not delivered to the server in time. So, when our app is not running(in the background OR NOT RUNNING AT ALL), the server would still send a message to that Firebase topic and iOS will receive it. My question is, how can I intercept a notification, and check whether it