User Notifications

RSS for tag

Push user-facing notifications to the user's device from a server or generate them locally from your app using User Notifications.

Posts under User Notifications tag

161 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

notification issue ios 17
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.
1
0
690
Oct ’23
Reloading data and rescheduling local notifications, based on AppIntent interaction in iOS 17 Widgets and Live Activities
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 :)
1
0
611
Nov ’23
UNNotificationServiceExtension Not Displaying Sender Image
I created a Notification Service Extension to display profile images in place for the app image (i.e. iMessage). I send a remote push notification via Firebase Functions, and in the payload, the relevant profile image url string. The profile image url string in the payload is successfully delivered as it appears in my console log and AppDelegate didReceiveRemoteNotification function. My problem is the profile image does not replace the default app icon image in the remote push notification. Below is my configuration. Any guidance would be appreciated! Main target app: the info plist contains NSUSerActivityTypes = [INSendMessageIntent]. The Communications Notifications capability is enabled and "Copy only when installing" in Build Phases Embed Foundation Extensions Notification Service Extension plist: contains NSExtension > NSExtensionAttributes > IntentsSupported > INSendMessageIntent. Notification Service Extension class code: var contentHandler: ((UNNotificationContent) -> Void)? var bestAttemptContent: UNMutableNotificationContent? override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { self.contentHandler = contentHandler bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) guard var bestAttemptContent = bestAttemptContent else { return } guard let fcmOptions = bestAttemptContent.userInfo["fcm_options"] as? [String: Any], let attachmentUrlAsString = fcmOptions["imageURL"] as? String else { contentHandler(bestAttemptContent) return } if let attachmentUrl = URL(string: attachmentUrlAsString) { var senderNameComponents = PersonNameComponents() senderNameComponents.nickname = bestAttemptContent.title let profileImage = INImage(url: attachmentUrl) let sender = INPerson(personHandle: INPersonHandle(value: "1233211234", type: .unknown), nameComponents: senderNameComponents, displayName: bestAttemptContent.title, image: profileImage, contactIdentifier: nil, customIdentifier: nil, isMe: false) let receiver = INPerson(personHandle: INPersonHandle(value: "1233211234", type: .unknown), nameComponents: nil, displayName: nil, image: nil, contactIdentifier: nil, customIdentifier: nil, isMe: true) let intent = INSendMessageIntent( recipients: [receiver], outgoingMessageType: .outgoingMessageText, content: "Test", speakableGroupName: INSpeakableString(spokenPhrase: "Sender Name"), conversationIdentifier: "sampleConversationIdentifier", serviceName: nil, sender: sender, attachments: nil ) intent.setImage(profileImage, forParameterNamed: \.sender) let interaction = INInteraction(intent: intent, response: nil) interaction.direction = .incoming interaction.donate(completion: nil) if #available(iOSApplicationExtension 15.0, *) { do { bestAttemptContent = try bestAttemptContent.updating(from: intent) as! UNMutableNotificationContent } catch { contentHandler(bestAttemptContent) return } } contentHandler(bestAttemptContent) } else { contentHandler(bestAttemptContent) return } } }
0
0
448
Sep ’23
Send Local Notifications from Endpoint Security Extension
Is it possible to send Local Notifications from Endpoint Security Extension ? When I was calling below block of code immediately after confirming that process was started center requestAuthorizationWithOptions:options completionHandler:^(BOOL granted, NSError * _Nullable error) center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) getting below error Requesting authorization failed with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.usernotifications.usernotificationservice was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.usernotifications.usernotificationservice was invalidated from this process.} Adding notification request failed with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.usernotifications.usernotificationservice was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.usernotifications.usernotificationservice was invalidated: failed at lookup with error 3 - No such process.} Please suggest what i'm missing here to send notification from EPS if it's possible.
0
0
286
Sep ’23
Multiple push notification service
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
2
0
839
Sep ’23
User Notifications Delayed on Watch
Hi, when sending notifications either via APNS remotely or locally on watchOS, they are delivered with a small but significant delay of ~12 to 20s. That doesn't sound like much, but when e.g. the notification is read on AirPods by Siri via the iOS companion app on the phone it's quite annoying having to wait for the long-look notification UI to appear on the watch to e.g. send a quick reaction. Interesting: If the watch is not connected to the phone, notifications are delivered as quick as on the iPhone (<1s delay). That makes me think that this behavior must be related to the notification forwarding feature as described here https://developer.apple.com/documentation/watchos-apps/enabling-and-receiving-notifications . For a "Dependent watchOS app with an iOS app" it is stated that "You can either send the notification just to iPhone, or send it to both devices. In either case, the system ensures that the user only receives one notification at the best destination." So the watch must somehow coordinate with the iPhone to not show a notification if the "same" (same APNS collapse id?) notification is delivered to the phone as well (?). Is there a way to disable this behavior? Thanks! Quirin
2
0
866
Sep ’23
Swift iOS notification sound problems
I'm currently working on a Swift project for an iOS app that involves receiving notifications. The app is designed to play different sounds based on a specific parameter when a notification arrives. The correct behavior to follow is as follows. There are two types of notifications in the project: start notifications and stop notifications. Once the app receives a start notification it starts an audio player, the audio lasts X seconds but is looped by the player so it potentially lasts forever. When the app receives the stop notification, the player stops and the sound stops. This works great when the app is in the foreground. When the phone is locked and therefore the app is closed, the sound that is heard is X seconds without the sound being repeated as it happens in the foreground. Furthermore, it often happens that when the stop notification arrives, the player does not stop and continues until the end of X s time. Does anyone have an idea of ​​how to put the loop to the sound of the notification with the phone locked and be sure that when the stop notification arrives the player stops? The sound stop works well on some devices while on others it doesn't even with the same iOS versions.
0
0
524
Aug ’23
Notification Content Extension not working in MacOS
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?
0
1
501
Aug ’23
Local notifications on tvOS
Hi: I want to know how to schedule a local notification in tvOS and when you tap it, open the app. I was reading the documentation: https://developer.apple.com/documentation/usernotifications/unnotificationcontent And I don't know why the title and body, for example, are unavailable for tvOS. Any help is welcome. Thanks in advance.
0
1
570
Aug ’23
Apple Web Push API doesnt work with HTTP/2
Hello, i try to send a Web Push Notification to my Safari Webbrowser and use the "http2" Module from Node.js Every other Browser is able to receive my messages. I got the message "BadJwtToken" but when i use the same Authorization Key with a HTTP/1.1 Request, i got a Message on Safari. Is there a Problem with the API when i use the HTTP/2 Protocol? Has anybody the same Problem? I send exactly the same Headers and as i said other Push APIs from Mozilla,Chrome and Microsoft e.t.c. are working with my HTTP2 Client.
0
0
640
Aug ’23
Background notifications and user interaction
The (archived) Local and Remote Notifications Programming Guide contains the following: To support a background update notification, make sure that the payload’s aps dictionary includes the content-available key with a value of 1. If there are user-visible updates that go along with the background update, you can set the alert, sound, or badge keys in the aps dictionary, as appropriate. The current documentation however reads: To send a background notification, create a remote notification with an aps dictionary that includes only the content-available key, as shown in the sample code below. You may include custom keys in the payload, but the aps dictionary must not contain any keys that would trigger user interactions. What caused this change and why is no longer supported to send additional keys (e.g. an alert dictionary) in the aps dictionary of a background notification?
0
0
476
Aug ’23
Strange behavior when scheduling multiple local notification with copies of an identical image attachment
If I schedule for example three local notifications and attach three different copies of the same image (copies are done before scheduling). Then if user in the notification center selects "Clear" on the first notification, then the next two notifications will be missing the attached image (although it was handed different copies of the same image). I already know that when scheduling a local notification with an image, iOS will either copy or move the supplied image (depending on file location) to some temp storage it uses for local notifications. So I make sure to first take individual copies of the image and then hand them to the local notification. I did find an ugly workaround to this problem that works. That for each copy of the image I slightly modify the image size and jpg compression of that identical image, then it doesn't happen. It's like iOS image duplicate detection logic is activated for local notifications, and I'm fighting some "hash", business-logic or machine learning evaluation if the images are duplicates and should be removed for all attachments when clearing notification (or the folder of the attachments). Which seems wrong. Bonus info: I even tried that if I only changed jpeg compression slightly on a small picture (200x200) then it could still happen, but if I then at the same time changed the image size by 1 pixel it would be fine. I also tired changing the same small image by 1pixel without compression then the problem happened.. So it feels like it's not a hash of the image (like MD5) but rather some logic or machine learning evaluation. I have on my to-do to try a one color image to see if that triggers the problem no matter size and compression, just for my curiosity. Experienced on iOS 15.6+ and 16+
0
0
262
Aug ’23
iOS 17 Beta Spam Firebase Push Notifications
Hello everyone Our application started to spam the Firebase Push Notifications when the device had the iOS 17 Beta. This behavior does not happen in iOS 16, but it was reproduced in many iOS 17 Beta (Beta 3, 4 & 5). The issue goes like this: Our backend service uses an SDK Firebase to send one notification The user receives the notification Then after some minutes, the device starts to receive the same push notification with the old date-time, by intervals of 5 to 15 minutes We also got reports of other people with the same issue: https://stackoverflow.com/questions/76620368/spam-of-fcm-push-notifications-on-ios-17-beta https://github.com/kreait/firebase-php/issues/814 You can see the following screenshot of the output of this after 2 hours:
11
7
3.0k
Oct ’23