Notification Center

RSS for tag

Create and manage app extensions that implement Today widgets using Notification Center.

Notification Center Documentation

Posts under Notification Center tag

72 Posts
Sort by:
Post not yet marked as solved
11 Replies
14k Views
Hi Team, I was trying to add NSE to my Project to show Rich messaging. Creation of the NSE target to the project - Successful. Creation of additional provisioning profile in developer portal for NSE and mapped it in XCode - Successful The APS payload contains the content-type: 1 and attachment url to download the media content - Successful. When notification arrive the will present method gets called first - Successful. The auto execution of Notification Service 'didReceive(_ request: UNNotificationRequest,          withContentHandler contentHandler: @escaping            (UNNotificationContent) - Void)' - failure. 6. Tried running the target instead of main app - failure 7. Tried attaching a debugger to get break point - failure 8. Debug and Console logs - failure 9. Additionally tried the below option from every developer suggestion but no luck. o  https://stackoverflow.com/questions/50853503/images-in-ios-push-notification o  https://stackoverflow.com/questions/51722109/unnotificationserviceextensions-didrecieve-not-called o  https://stackoverflow.com/questions/39663903/ios10-unnotificationserviceextension-not-called o  https://stackoverflow.com/questions/46463680/notificationserviceextension-not-called o  https://stackoverflow.com/questions/45483018/unnotificationserviceextension-not-working-on-iphone-5-ios-10 Could you please assist on the same to get it working as the notification service methods cannot be called explicitly and it needs to be triggered by OS. A quick, faster response and resolution is much appreciated.
Posted
by
Post not yet marked as solved
2 Replies
3.2k Views
Team, is there anyway, if we can wakeup the app while it is in suspended mode. I am using BLE scanning to share/receive the TCN token and generate notifications, but while app in sleep/suspended mode it stops. is there anyway to trigger this scanning or wake up the app without any manual intervention. we are trying to achieve this with help of silent notifications. can you help to figure out how many silent notification we can trigger in an hour ?
Posted
by
Post marked as solved
3 Replies
4.3k Views
Using addObserver func of NotificationCenter.default, subscribing to UIApplication.willEnterForegroundNotification does not work when the backgrounding is triggered from Notification Center (swipe down from top when app is active to get Notification Center).  It also seems that UIApplication.willResignActiveNotification is called twice, based on Print() logs, when Notification Center triggers the backgrounding. If you background the app via lock screen or manual swipe, or switch to another app, the UIApplication.willEnterForegroundNotification does get called, so it seems to be specific to Notification Center. UIApplication.willResignActiveNotification does fire correctly but then resuming the app never calls the appMovedToForeground func below: notificationCenter.addObserver(self, selector: #selector(appMovedToForeground), name: UIApplication.willEnterForegroundNotification,object: nil) occurs on: iOS 14.4.2, iPhone 11 & iOS 14.6, SE(2)
Posted
by
Post not yet marked as solved
3 Replies
2.1k Views
Hi. I implemented a broadcast upload extension and it requests local notifications. The local notification works normally on broadcastStarted(withSetupInfo:), but the Banner of the local notification does not work on processSampleBuffer(_: with:) though its Notification Center works normally. What am I missing? Here is my code snippets. container app class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. requestAuthorization() ... } private func requestAuthorization() { let center = UNUserNotificationCenter.current() center.requestAuthorization(options: [.alert]) { granted, error in if let error = error { // Handle the error here. print(error) } if granted == true { center.delegate = self center.getNotificationSettings(completionHandler: { setting in print(setting) }) } else { print("not permitted") } } } } upload extension class SampleHandler: RPBroadcastSampleHandler { override func broadcastStarted(withSetupInfo setupInfo: [String : NSObject]?) { super.broadcastStarted(withSetupInfo: setupInfo) notification(title: "Upload Extension", body: "broadcastStarted") ... } override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) { super.processSampleBuffer(sampleBuffer, with: sampleBufferType) ... if some condition { notification(title: "Upload Extension", body: "processSampleBuffer") } } private func notification(title: String, body: String) { let content = UNMutableNotificationContent() content.title = title content.body = body let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil) let notificationCenter = UNUserNotificationCenter.current() notificationCenter.add(request) { error in if error != nil { print(error) } } } }
Posted
by
Post not yet marked as solved
3 Replies
1.8k Views
Hi, I have a long process that I need to report to the User via UNNotificationCenter (local) notifications. Say - scanning a big folder with thousands of files, finding and reporting "bad ones" as they are identified. I currently emit periodic notifications, keeping the same "thread identifier", which causes each new notification to replace the one displayed, thus updating the texts. However - when they become many, the behavior is inconsistent and it looks bad. What I'd like to do is: Have a single DELIVERED notification (displayed on-screen) that will change its contents (say- advances a progress bar, and updates its text periodically. I KNOW that this is possible, because Apple publishes a notification almost identical to what I need in AirDrop UI. When a bunch of documents are dropped by some external device onto my Mac - I receive a notification like this: Which updates until the file transfer is finished. I searched both these forums, the documentation, and other resources, but did NOT find any hint on how to implement such thing. There's something for iOS called "App Extension" that can customize Notification UI - but I did not find any documentation or code-sample or anything - and all I found was descriptions of behavior on iOS, so I'm not sure that's the way to do it on MacOS. Can you please advise?
Posted
by
Post not yet marked as solved
5 Replies
2.2k Views
Hello! Two of my watch apps (HiCoffee and HiWater) occasionally have issues with complications not displaying properly on watchOS 9. I did NOT use the new WidgetKit to implement the complications, all the related code still uses the same previous ClockKit + SwiftUI. I have observed several different types of wrong behaviors. One specific complication cannot be displayed (rendered?), while others do work (from the same app). This indicates that my watch app is working properly. All complications on the face cannot be displayed. But the app logs indicates it's running properly. In addition, when you long press the face to edit complications, yet it can be displayed normally. Log shows CLKComplicationServer.sharedInstance().activeComplications always returns 0 no matter how many complications are added to the face. Also, the ComplicationController is NOT called by system. I'm not using WatchKit. This part of the code in my app has been working properly for a long time and has not been changed. But after the release of watchOS 9, I received a lot of feedback from users with this problem. So I think the problem is in watchOS 9. I haven't found a way to reproduce the problem yet. Any suggestions please?
Posted
by
Post not yet marked as solved
1 Replies
536 Views
We have a watchos app that uses notifications to display time sensitive information to the users. We are using UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false), our usernotification center looks like this func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { print("It got here to showing the notifications and this is when it is shown: \(Date()) and this is the type of notification: \(notification.request.identifier)") completionHandler([ .list, .sound, .banner ]) }. The problem is that the usernotification center is called correctly but no notification is given, every time 13 seconds later it is called twice again and only then does the notification display to the users. I have tried changing the type of trigger for the notification but even that did not get rid of the thirteen second delay.
Posted
by
Post not yet marked as solved
0 Replies
696 Views
I've been struggling with writing some dependency injection types for Foundation types like NotificationCenter, UIDevice, etc. I've created a sample package to demonstrate: https://github.com/MFB-Technologies-Inc/notification-center-client-demo. The goal is to mimic NotificationCenter's Publisher and notifications AsyncSequence. LiveNotificationCenterClientTests.testStream will fail unless it's run in isolation. If more than one test is run, it will never complete because no values are ever received from the stream. MockNotificationCenterClientTests.testPublisher fails because the expectations are not fulfilled before the timeout. For whatever reason, the published values are not being received in the sink. MockNotificationCenterClientTests.testStream never completes because the value is being endlessly awaited. It seems that there are some fundamental things about concurrency that I'm getting wrong. Can anybody help me debug this? For the two stream tests, I know I could rewrite them to fail with a timeout like the publisher tests but that's not the real problem.
Posted
by
Post not yet marked as solved
0 Replies
438 Views
lately, we found out that all notifications from the app I developed suddenly vanished for no reason when a new notification arrived. Mostly this case happened on iOS 16, and the notification has threadID by which we want to fulfill the notification grouping. When I continuously sent 4-5 notifications to my iPhone this case will happen. Problem screen recording did anyone encounter this situation? Why and how to fix it
Posted
by
Post not yet marked as solved
0 Replies
753 Views
HELLO! I just bought a MacBook Pro M2 32g ssd 1t Ram thinking I had the best machine to work with videos and video's programs. I'm a visual artist, I use Resolume Arena and when I moved on the new computer my program, it starts to crash! I tried several times to install-uninstall the program and I don't know why is making that. This is what appears: Translated Report (Full Report Below) Process: Arena [935] Path: /Applications/Resolume Arena 6/Arena.app/Contents/MacOS/Arena Identifier: com.resolume.arena Version: 6.1.5 (6.1.5.68469) Code Type: X86-64 (Translated) Parent Process: launchd [1] User ID: 501 Date/Time: 2023-06-30 06:26:25.5102 +0200 OS Version: macOS 13.4 (22F66) Report Version: 12 Anonymous UUID: BBEB6B45-F295-0C98-2890-2A64E6E53977 Sleep/Wake UUID: AD36FAD9-7084-4522-9FA0-015CEAC0ABA5 Time Awake Since Boot: 230 seconds Time Since Wake: 12 seconds System Integrity Protection: enabled Crashed Thread: 9 Exception Type: EXC_ARITHMETIC (SIGFPE) Exception Codes: 0x0000000000000001, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 8 Floating point exception: 8 Terminating Process: exc handler [935] Thread 0:: Juce Message Thread Dispatch queue: com.apple.main-thread 0 ??? 0x7ff8909e69a8 ??? 1 libsystem_kernel.dylib 0x7ff800da6fbe __semwait_signal + 10 2 libsystem_c.dylib 0x7ff800c99585 nanosleep + 196 3 Arena 0x1051a4369 0x104c11000 + 5845865 4 Arena 0x1051a3c9e 0x104c11000 + 5844126 5 Arena 0x105119e60 0x104c11000 + 5279328 6 Arena 0x105119b85 0x104c11000 + 5278597 7 Arena 0x105111c87 0x104c11000 + 5246087 8 Arena 0x1055e7406 0x104c11000 + 10314758 9 Arena 0x1055e6c5c 0x104c11000 + 10312796 10 Arena 0x1055e6323 0x104c11000 + 10310435 11 Arena 0x105398455 0x104c11000 + 7894101 12 Arena 0x1058d289e 0x104c11000 + 13375646 13 Arena 0x105736756 0x104c11000 + 11687766 14 Arena 0x1051ed004 0x104c11000 + 6144004 15 Arena 0x1052dc7e1 0x104c11000 + 7124961 16 Arena 0x1051ecf14 0x104c11000 + 6143764 17 Arena 0x1051eceaf 0x104c11000 + 6143663 18 dyld 0x2067d841f start + 1903 Thread 1:: com.apple.rosetta.exceptionserver 0 runtime 0x7ff7ffdb0694 0x7ff7ffdac000 + 18068 Thread 2: 0 runtime 0x7ff7ffdce87c 0x7ff7ffdac000 + 141436 Thread 3: 0 runtime 0x7ff7ffdce87c 0x7ff7ffdac000 + 141436 Thread 4: 0 runtime 0x7ff7ffdce87c 0x7ff7ffdac000 + 141436 Thread 5: 0 ??? 0x7ff8909e69a8 ??? 1 libsystem_kernel.dylib 0x7ff800da70ee __psynch_cvwait + 10 2 libsystem_pthread.dylib 0x7ff800de3758 _pthread_cond_wait + 1242 3 Arena 0x1050707dc 0x104c11000 + 4585436 4 Arena 0x104fd5afe 0x104c11000 + 3951358 5 Arena 0x105075907 0x104c11000 + 4606215 6 libsystem_pthread.dylib 0x7ff800de31d3 _pthread_start + 125 7 libsystem_pthread.dylib 0x7ff800ddebd3 thread_start + 15
Posted
by
Post not yet marked as solved
0 Replies
560 Views
As I sit here on the fourth hour waiting for Xcode to install. Can’t help, but think it would be nice if there was a way for notifications to be sent to my phone when applications on my computer have finished downloading, or installing
Posted
by
Post not yet marked as solved
4 Replies
1.3k Views
We have an app where the notification service extension works well most of the time. However, sometimes we have noticed that the extension completely stops working even when the notification is sent successfully via the APNS server in production. We do not see even the log from the didReceive() function in that case. The only way we can get the extension working again is after restarting the iPhone. Trying to understand when this might happen? Is it something that is throttled by iOS? Would it happen when the device memory is low or the app is using too much memory? We have seen the extension crash sometimes due to hitting memory limits, however, the extension process is spawned again when a new notification comes in. Any kind of help or guidance would be greatly appreciated. Thanks We have setup acknowledgment API calls in the notification service extension processing to be notified when the notifications reach the device. So based on that we know how often the devices stop responding with the ACK to sent notifications. It happens seldom with some users and we have to ask them to restart their device to get the extension functional again.
Posted
by
Post not yet marked as solved
0 Replies
447 Views
Hi! I have some trouble with local notification delivery on Apple Watch. It can take more than 1 minute to see the first local notification delivered. I made sure to not use a trigger so the notification will be delivered right away possible as specified in the UNNotificationRequest initializer doc. But there is always a delay for notification delivery. Here is how I'm creating the local notification: content.title = "title" content.subtitle = "subtitle" content.body = "body" content.userInfo = "userInfo" content.categoryIdentifier = "categoryIdentifier" content.threadIdentifier = "threadIdentifier" content.sound = UNNotificationSound.default let notifyRequest = UNNotificationRequest(identifier: stringWithUUID(), content: content, trigger: nil) let center = UNUserNotificationCenter.current() center.add(notifyRequest) { ( error: Error?) in if let theError = error { print(theError.localizedDescription) } else { print("Scheduled OK") } } Do you have any idea how to avoid the delay? Best!
Posted
by
Post not yet marked as solved
1 Replies
567 Views
In Xcode 15 beta 1 to 5, the watch face preview of accessoryRectangular and accessoryCircular are always rendered in tinted mode, even if you choose multicolor. (NOTE: Please don't ask me to provide diagnostic data for Preview. Because this issue is 100% reproducible.)
Posted
by
Post not yet marked as solved
0 Replies
721 Views
Hey, I am currently trying to add deeplink handling from tapping on push notifications in my watchOS application with a SwiftUI lifecycle. I already have deeplinking working with several onOpenURL modifiers throughout the app for the iOS version. What I wanted to do, is whenever I receive a push notification I construct an URL and then utilise the onOpenURL view modifier to handle the deeplink. I currently struggle to understand if this is possible at all. I have the following setup @main struct WatchApp: App { @WKApplicationDelegateAdaptor var appDelegate: WatchAppDelegate // MARK: - Body var body: some Scene { WindowGroup { ContentView() } } } class WatchAppDelegate: NSObject, WKApplicationDelegate, ObservableObject { func applicationDidFinishLaunching() { UNUserNotificationCenter.current().delegate = self } } extension WatchAppDelegate: UNUserNotificationCenterDelegate { func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async { // handle the push notification } } I do receive the the notification as expected in userNotificationCenter(center:, didReceive:) but from there on I didn't find a way bring this information into my app. On iOS I do leverage UIApplication.shared.open(url:) but this is obviously not available on watchOS. What is the official guidance of handling watchOS deep links with SwiftUI lifecycle from tapping of push notifications ? Currently the onOpenURL modifiers are placed on several views, so it would be nice if there is a way to trigger them from a central place. Would be really appreciated if someone knows a way on how to do it :)
Posted
by
Post not yet marked as solved
1 Replies
753 Views
As Swift give as async await functions, I tried to use them for push notifications. In my case if I use extension TMNotificationCenter: UNUserNotificationCenterDelegate { func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { completionHandler([.sound, .banner, .list, .badge]) } func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { completionHandler() } } There are no error, erevything works fine, but when I change to this: extension TMNotificationCenter: UNUserNotificationCenterDelegate { func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async -> UNNotificationPresentationOptions { print(#function) return [.sound, .banner, .list, .badge] } func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async { print(#function) } } I got crash: What I am doing wrong?
Posted
by
Post not yet marked as solved
0 Replies
409 Views
My app uses UNMutableNotificationContent() to play a custom sound, and has a phrase as a message. I just got a vehicle with CarPlay. When my iPhone is connected to CarPlay, when the notification goes off at a time, it shows on the iPhone, but does not make any noise whatsoever. What I'd like to happen, is for CarPlay to announce the message when the notification goes off, like it does with Apple's messages app. As my phone is set right now, when I have my airPods in, it will announce the notification from my app. But not for CarPlay. What do I need to add to my app to allow CarPlay to announce the message that comes in from a notification (again, local, not a push notification).
Posted
by