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
0 Replies
558 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 Last updated
.
Post not yet marked as solved
0 Replies
379 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 Sodasi.
Last updated
.
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 buschco.
Last updated
.
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 Last updated
.
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 rkgbr.
Last updated
.
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
Posted Last updated
.
Post not yet marked as solved
1 Replies
939 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 Last updated
.
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 alessioba.
Last updated
.
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 Last updated
.
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 Last updated
.
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 Last updated
.
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 Last updated
.
Post marked as solved
2 Replies
740 Views
There are two ways to capture application transitioning to foregorund/background and inactive/active. Lets take the event received when app transitions to the inactive state as an example. Implement the corresponding AppDelegate method - applicationWillResignActive(_:) func applicationWillResignActive(_ application: UIApplication) { Log("applciationWillResignActive(_:)") } Register for willResignActiveNotification during startup NotificationCenter.default.addObserver(forName:UIApplication.willResignActiveNotification, object: nil, queue: .main) { (broadcastNotification: Notification) in Log("Received " + String(describing: broadcastNotification.name)) } When I tested in code, both works. First, the applicationWillResignActive(_:) delegate method is invoked and then, willResignActiveNotification is received (as mentioned in the documentation). But I'm unable to decide which to use... even after reading their documentation. What is the recommendation? If both are fine, then there are two different ways to achieve the same thing... there's gotta be some purpose, right?
Posted
by GangOrca.
Last updated
.
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 mp094310.
Last updated
.
Post not yet marked as solved
0 Replies
276 Views
I want to schedule a local notification every day at a particular time. When I receive the local notification I need to start location service irrespective of the app state. i.e. even when the app is killed or in the background I want this to be done.
Posted Last updated
.
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 Last updated
.
Post not yet marked as solved
0 Replies
419 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 ShadowDES.
Last updated
.
Post not yet marked as solved
1 Replies
793 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 Rubennah.
Last updated
.