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

71 Posts
Sort by:
Post not yet marked as solved
1 Replies
333 Views
Using the following function: userNotificationCenter( _ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void ) I am utilizing the response to process a notification with an action and I am running into some odd behavior when the application is fully killed prior. Following all of the work that needs to be completed related to the action, I make sure to call the completionHandler at the right time. This works as expected, but I am trying to understand why does the application continue to run? While the application may not show as running after the work is completed and completionHandler() is called, it is evident that it is still running as when I go to open it, it picks back up from my dashboard screen and has all the data already loaded. Since the app was killed prior to performing the notification action, I expect the app to be killed/terminated after calling completionHandler(). This way after opening it up normally, it should start from the beginning. Why does the app continue to run in this case?
Posted
by
Post not yet marked as solved
0 Replies
463 Views
I've set up a Notification Content Extension for my app, but it's not getting called(tried both local and remote push). I've read the Apple dev guide, and I've set up everything as it says. https://developer.apple.com/documentation/usernotificationsui/customizing_the_appearance_of_notifications I've looked over the common issues (setting proper deployment targets and setting category identifiers from the backend and in the .plist) After receiving the notification, I'm not able to get the expanded view and neither is the didReceive(_ notification: UNNotification) of my extension view controller getting invoked. Is there something I'm missing while doing the extension setup, I m not able to figure out the problem? Also, I m not able to understand this note from apple "Notification content app extensions are supported only in iOS apps" when all the Notification content Extension APIs are provided for MacOS also?
Posted
by
Post not yet marked as solved
0 Replies
368 Views
I have created a Notification service extension as target to the main MacOS application. I want to update the content of my remote notification using this extension but due to some reason the extension is not getting invoked to update my remote notification. The auto execution of the below method seems to fail for my app extension. didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) I have tried the suggested solutions in this link but it did not help. Maybe there are some differences to using Notification service for MacOS and ios that I m not aware. I am able to send normal remote notifications using the curl command, but it is not invoking the notification service extension. Below is the curl command. curl -v --header "apns-topic: $TOPIC" --header "apns-push-type: alert" --header "authorization: bearer $AUTHENTICATION_TOKEN" --data '{"aps": {"mutable-content": 1,"alert": {"title": "Encrypted title","body": "Encrypted body"}},"MEETING_ORGANIZER": "MyMeet"}' --http2 https://${APNS_HOST_NAME}/3/device/${DEVICE_TOKEN} Is there anything I m missing that is causing this problem?
Posted
by
Post not yet marked as solved
0 Replies
611 Views
In our messenger application, we want to provide users with the ability to select notification sounds for push notifications from standard iOS sounds and ringtones (for example, Glass or Noir). In the documentation, I found only the ability to use my own sounds in .aiff, .wav, or .caf formats, having previously placed them in a bundle or in /Library/Sounds or one default sound(https://developer.apple.com/documentation/usernotifications/unnotificationsound). Can I independently place the downloaded files of the default iOS notification sounds in the bundle of the application in order to play them when receiving the notification and on the notification sound selection screen in the application? And will I have problems with such an implementation when reviewing the application?
Posted
by
Post marked as solved
2 Replies
722 Views
my app using FCM and pushy to deliver notif at the same time, the situation that is happening now is that I am getting two similar notification banners. How do I delete/cancel one of the notification banners when one of them has appeared. How do I handle this on the frontend side? If it is not possible/not recommended, can you please provide documentation from Apple so that it is best to change it on the server side
Posted
by
Post not yet marked as solved
1 Replies
575 Views
Hi everyone, I have two questions regarding some issues with the new iOS 17 interactive widgets and live activities. Question 1: How can I update other Widgets and/or Live Activities, based on an AppIntent interaction in either one? I have several widgets that is displaying the same information, but in different sizes (Small, Medium, Large and Lockscreen). Most of our users are using many of them together on their Lockscreen and Home Screen. When they are interacting with the AppIntent button in either the Widget og LiveActivity it does not update and vice-versa. Based on the documentation it's pretty clear that interacting with a Widget it will update the timeline for that specific widget after the .perform() in the AppIntent is returned. Unfortunately, I also need to update the LiveActivity and the other TimeLines for the rest of the widgets. I have tried to use the WidgetCenter.shared.reloadAllTimelines() but it seems like it does not update the LiveActivity or the LockScreen widgets correctly. Question 2: How can I update and reschedule the local notifications based on the interaction in the Widget and Live Activity? The app sends a local notification whenever an activity starts or stops (e.g like a pomodoro timer with intervals). Let's assume the user have setup a 30 minute activity in the app, but now decides to pause the activity from either the widget or live activity. I then want to remove the scheduled local notification that was supposed to be fired in 30 minutes. I haven't been able to read from the documentation if this is possible, but would like to know if there is any way this can be performed. Looking forward to hear if anyone have encountered the same challenges :)
Posted
by
Post not yet marked as solved
1 Replies
655 Views
Since my last update on my iPhone I am unable to hear any notification from applications like Nest or Google Home. I have several videocameras that I need notifications and alerts from and the sound that the phone produces is ridiculous for sure will not alert me in any way. Not even vibration is possible to set. This problem needs urgent intervention, I suppose there are millions of users risking burgleries or other problems until it is not fixed.
Posted
by
Post not yet marked as solved
1 Replies
941 Views
Hi there, This is my first time posting here. I'm working on small projects on Swift and SwiftUI now and then. I'm currently trying to develop an application that gets some bus arrival data using API and displaying them with live activities. The thing is that I'm not quite sure how frequently updates work yet. Still trying to figure out if I can update the live activity everytime the data coming right from the API changes or use push notification updates each minute passing by, but that is another thread that I'm going to focus with more details. Everytime i'm trying to deploy my app on my iphone or a simulator this error keeps popping up and I can't figure out why. Any ideas? Let me know if you need any snippet of my code. SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget 'com.gregorikouk.MapKitTut.BusWidgetKit' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xb1282dfe0 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)}}, FBSOpenApplicationRequestID=0xe5da, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}." UserInfo={NSLocalizedDescription=Failed to show Widget 'com.gregorikouk.MapKitTut.BusWidgetKit' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xb1282dfe0 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)}}, FBSOpenApplicationRequestID=0xe5da, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}., NSUnderlyingError=0xb1281d830 {Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xb1282dfe0 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.gregorikouk.MapKitTut.BusWidgetKit)}}, FBSOpenApplicationRequestID=0xe5da, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}}} Domain: DTXMessage Code: 1 User Info: { DVTErrorCreationDateKey = "2023-10-02 21:06:04 +0000"; } -- System Information macOS Version 14.0 (Build 23A344) Xcode 15.0 (22265) (Build 15A240d) Timestamp: 2023-10-03T00:06:04+03:00
Posted
by
Post not yet marked as solved
1 Replies
510 Views
I am working on an interactive widget and merging changes provided by a user over it with the app. I store my data, using Core Data. However, I noticed an issue with sync between other user's devices after that person made a change over the widget (in my case, it is completing a task). Here is my schema: Main app: it looks for relevant transactions (https://developer.apple.com/documentation/coredata/consuming_relevant_store_changes). When it found that one, the app merges changes: if transaction.author == "widget" { if let userInfo = transaction.objectIDNotification().userInfo { NSManagedObjectContext.mergeChanges(fromRemoteContextSave: userInfo, into: [taskContext]) } } Widget: If the user clicks on the checkbox in order to complete a task, using an AppIntent class, app creates an identical NSPersistentCloudKitContainer and completes the task. However, in that case, the NSPersistentCloudKitContainer of the widget does not look for changes. That works correctly. However, only in a local environment. Here's why: If I complete a task (using a widget) and launch the app on the same device, the change will be synced correctly. If I complete a task (using a widget) (on device A) and launch the app on another device (on device B), the change will not be applied (on device B), until I open the app on the device that I made the change on (on device A). If I open the app on device B after I opened it on device A (and the changed has been applied), on device A I get a remote notification with the author value = 'NSCloudKitMirroringDelegate.import', not 'widget'. The point of my issue is that the remote notifications about changes made, using widgets, does not arrive to other devices like notifications initialised by the main app. Thank you in advance!
Posted
by
Post not yet marked as solved
0 Replies
238 Views
I have this code in my app: NotificationCenter.default.addObserver(self, selector: #selector(innerFrameDidChange), name: NSView.frameDidChangeNotification, object: mInnerTextView!) mInnerTextView is not nil I have this on initialization mInnerTextView!.postsFrameChangedNotifications = true (and, yes, ! is bad, I know, this code has not changed in years) The issue is that under Sonoma this notification is not firing nearly as often as in previous OSes. Specifically it does not fire when the window is resized, which does change the frame of mInnerTextView. Anyone have any recommendations? Thanks Howard
Post not yet marked as solved
0 Replies
385 Views
I've found an issue introduced in iOS 17. Apps that have notifications in CarPlay (Message, Whasta, Telegram, etc...) can play sounds without the need of displaying any notification alert. If you turn "Show in CarPlay" to off, which is the default value for all other apps, sound will not play unless you check at least one alert type.
Posted
by
Post not yet marked as solved
1 Replies
609 Views
UPDATE: So I discovered that if UIScreen.main.traitCollection.userInterfaceStyle is called in a notification service extension then it doesn't detect any change to the iPhones light/dark mode unless the phone is restarted. (I tried with other extensions, changes are detected immediately in other extensions, however not with a notification service extension nor in a notification content extension). ORIGINAL POSTING: I've got a notification service extension which is populating the notification with images before it's displayed. The images are part of an image set with different images for light and dark modes. What I've discovered is that which image is displayed in the notification depends upon whatever mode the phone was in when the app was installed or when the phone was restarted and it will stay like that for any subsequent posted notifications forever regardless of what the phone's light/dark mode setting is, unless the phone is restarted. Here's an example to illustrate what I mean, here's an image set in the Media.xcassets for the extension, its called "Grunt". And here's some code in the extension: notificationContent!.title = "GRUNT" if let url = URL(forImageResource: "Grunt") { do { let attachment = try UNNotificationAttachment(identifier: "imageAttachment", url: url) notificationContent!.attachments = [attachment] } catch { NSLog("error") } } contentHandler(notificationContent!) When the app is installed, if the phone is set to light mode, then when a notification is posted the 2x Light image is displayed in the notification. If the phone's setting is then changed to dark, then the 2x Light image still continues to displayed in all subsequent notifications that get posted. Conversely, if the phone is set to dark mode when the app is installed then the 2x Dark image is displayed in a notification, similarly if the phone's settings are changed to Light, the Dark image continues to be displayed for any new notifications posted. Until the phone is restarted - then any new notification display in accordance with whatever the phone's dark mode is set to at the time the phone is restarted. In other words, if the phone's light/dark mode setting is changed, new notifications posted don't display the appropriate light/dark image from the image set unless the phone is restarted. (Occurs with both iOS 16 and 17)
Posted
by
Post not yet marked as solved
0 Replies
356 Views
Hi, I was wondering if it was possible to get a notification when there is a change to the forced defaults that my app uses. This forced defaults are sent via MDM using the com.apple.ManagedClient.preferences payload type. I've seen that UserDefaults.didChangeNotification is available but it only works if the change is made from inside the app and not if the payload gets updated by the MDM. class MySettings { private let defaults = UserDefaults(suiteName: "com.myapp.app.mysettings") init() { // Somehow register for notifications } func defaultsChanged() { // This would be called when the defaults change } }
Posted
by
Post not yet marked as solved
0 Replies
352 Views
I use a UNNotificationServiceExtension to download an image into temporaryDirectory that is attached as an UNNotificationAttachment to the notification. FileManager.default.temporaryDirectory .appendingPathComponent(UUID(). .appendingPathExtension(image.ext) data.write(to: fileUrl) let attachment = ... attachments.append(attachment) The documentation for UNNotificationAttachment say I am responsible to manage the storage space for such attachments: The system limits the amount of storage space allocated for attachments for each app. To delete attachments, use the methods of the UNUserNotificationCenter class to remove the notification requests that contain those attachments. https://developer.apple.com/documentation/usernotifications/unnotificationattachment Do I need to check in my AppDelegate if there are any notifications that are no longer displayed and remove their files? If so, how how to get a list of notifications that are no longer displayed?
Posted
by
Post not yet marked as solved
2 Replies
482 Views
I want to change the notification tap behaviour. As we know that default behaviour of notification is when we tap or touch on notification then it opens the app and when we press and hold (long press) the notification then its shows the notification preview (should become interactive notification) and we can interact through notification without opening the app. 
But I want to reverse the default behaviour of notification i.e. when we tap or touch on the notification then it should open the notification preview (should become interactive notification) and we can interact through notification without opening the and when we press and hold the notification then it should open the app.

Could you please guild me how can I implement this notification feature.
Posted
by
Post not yet marked as solved
0 Replies
380 Views
i does not implementation background push notification in my app. however i found my app launch in background(applicationState is equal to background inapplicationDidFinishLaunch method) and launchOptions contained UIApplicationLaunchOptionsRemoteNotificationKey. the value of UIApplicationLaunchOptionsRemoteNotificationKey does not contained content-available : 1 is it a bug or sepcial case ?
Posted
by
Post not yet marked as solved
0 Replies
560 Views
As iOS 17 has begun to roll out, our team has noticed a crash increasing in our production application. This crash revolves around UNUserNotificationCenter and calling .getNotificationSettings(completionHandler:) in order to retrieve the users UNNotificationSettings. Upon adding extra logging to our production app, we've determined that in the callback of getNotificationSettings, trying to access the returned value UNNotificationSettings is what's crashing our app. Here's our stacktrace: Crashed: com.apple.usernotifications.UNUserNotificationServiceConnection.call-out EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000 0 libswiftCore.dylib 0x3fd3ec swift_getObjectType + 40 1 libswiftCore.dylib 0xd660c _print_unlocked<A, B>(_:_:) + 348 2 OurApp 0x23f8ec closure #1 in closure #1 in MessagingPermissionsModel.authorizationStatus.getter + 155 (MessagingPermissionsModel.swift:155) 3 OurApp 0x8bd98 partial apply for closure #1 in UNUserNotificationCenter.getNotificationSettings(completionHandler:) + 28 4 OurApp 0x8b9bc thunk for @escaping @callee_guaranteed (@guaranteed UNNotificationSettings) -> () + 52 (<compiler-generated>:52) 5 libdispatch.dylib 0x26a8 _dispatch_call_block_and_release + 32 6 libdispatch.dylib 0x4300 _dispatch_client_callout + 20 7 libdispatch.dylib 0xb894 _dispatch_lane_serial_drain + 748 8 libdispatch.dylib 0xc3f8 _dispatch_lane_invoke + 432 9 libdispatch.dylib 0x17004 _dispatch_root_queue_drain_deferred_wlh + 288 10 libdispatch.dylib 0x16878 _dispatch_workloop_worker_thread + 404 Here is also the variable in which this crash is happening (along with our extra logging). We wrap the auth status in a RxSwift single for subscribers. 149 private var authorizationStatus: Single<UNAuthorizationStatus> { 150 Logger.debug("MessagingPermissionsModel.authorizationStatus GET") 151 return Single.create { [weak self] observer -> Disposable in 152 Logger.debug("MessagingPermissionsModel.authorizationStatus Single created") 153 self?.userNotificationCenter.getNotifictionSettings { [weak self] settings in 154 Logger.debug("MessagingPermissionsModel.authorizationStatus Retrieved notification settings") 155 (Crashes here) Logger.debug("MessagingPermissionsModel.authorizationStatus Settings \(settings)") 156 Logger.debug("MessagingPermissionsModel.authorizationStatus Auth Status \(settings.authorizationStatus)") 157 Logger.debug("MessagingPermissionsModel.authorizationStatus Observer \(String(describing: observer))") 158 Logger.debug("MessagingPermissionsModel.authorizationStatus Self \(String(describing: self))") 159 observer(.success(settings.authorizationStatus)) 160 Logger.debug("MessagingPermissionsModel.authorizationStatus Observer invoked") 161 } 162 Logger.debug("MessagingPermissionsModel.authorizationStatus Disposable will return") 163 return Disposables.create() 164 } 165 } From what we've seen so far, I'm lead to believe this is a bug in iOS 17.
Posted
by
Post not yet marked as solved
3 Replies
695 Views
Hello all. I face problem with Notification Service Extension. User mobile receive notification without any problem, payload contain mutable-content:1 inside it ( also, full example of payload is attached ), but, NSE didn't run correctly, also, original content of notification didn't saw ( in case, and there is a crash because of something wrong in app ) I checked device logs, and I see next errors: [*] Mutated notification request is nil, will supress original content; notificationRequest=7019-8D60, error=Error Domain=NSCocoaErrorDomain Code=4097 "connection from pid 487 on anonymousListener or serviceListener" UserInfo={NSDebugDescription=connection from pid 487 on anonymousListener or serviceListener}, runtime: 0.410339 [*.notificationextension] Service extension connection encountered an error: sessionUUID=88D39801-67DF-4DC7-AA70-2AD7E8634369, error=Error Domain=NSCocoaErrorDomain Code=4099 "The connection from pid 505 on anonymousListener or serviceListener was invalidated: client is gone." UserInfo={NSDebugDescription=The connection from pid 505 on anonymousListener or serviceListener was invalidated: client is gone.} example of payload: "aps": { alert = { "loc-args" = ( msisdn ); "loc-key" = "key"; }; badge = 1; "content-available" = 1; "mutable-content" = 1; sound = "pnsound.aiff"; }, "m": CFG, "j": msisdn, "t": id, "n": M] This problem is face from time to time, I can't catch this problem on same build and same environment, also, this problem can occur for some time, and after that everything will be fine
Posted
by