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

157 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

iOS 15 - "Keep..." button in provisional user notifications doesn't save the settings
Hi, When receiving provisional user notifications in iOS 15 the "Turn Off..." button works fine, but the "Keep..." button doesn't save the settings. "Deliver Immediately" option doesn't do anything and "Deliver in Scheduled Summary" hides the buttons, but they appear again in next notification. I've noticed this behavior with several different apps, for example Reddit. Does anyone know anything about this? I have also submitted a bug to Apple but no response so far.
7
1
2.4k
Sep ’23
Using UNNotificationServiceExtension with FCM not getting called
I don't know what could be wrong but my UNNotificationServiceExtension is never getting called by any push from FCM. I call the FCM from a Python3 script and so far it works (I get a push notification but always with the default text and not the modified one). firebaseHeaders = { "Content-Type":"application/json", "Authorization":"key=MYKEY" } firebaseBody = { "to":devicetoken, "priority":"high", "mutable-content":True, "apns-priority":5, "notification": { "titlelockey":"push.goalReachedTitle", "bodylockey":"push.goalReachedContentRemote", "bodylocargs":[str(entry['value']), entry['region']], "sound":"default", "badge":1 }, "data": { "values":data, "region":entry['region'], "value":entry['value'] } } firebaseResult = requests.post("https://fcm.googleapis.com/fcm/send", data=None, json=firebaseBody, headers=firebaseHeaders) My Extension is also pretty basic (for testing) and I already tried to remove it and add it again to my main app project without success. class NotificationService: UNNotificationServiceExtension { 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) if let bestAttemptContent = bestAttemptContent { bestAttemptContent.title = bestAttemptContent.title + " [TEST 123]" contentHandler(bestAttemptContent) } } override func serviceExtensionTimeWillExpire() { // Called just before the extension will be terminated by the system. // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used. if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent { contentHandler(bestAttemptContent) } } } Anyone has a idea what I still can check, test or miss?
7
2
6.7k
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
519
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
494
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
561
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
631
Aug ’23
Notification Service Extension Not working
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.
12
2
15k
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
469
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
256
Aug ’23
Bluetooth ANCS don't send ringing alarm clock and countdown timer
Hello everyone, sorry for my ignorance about it, with ANCS I managed to get all the notifications except the alarm that rings and the timer expired, where am I wrong? do they travel on other channels like gatt? if yes can someone help me understand how to receive these 2 information? the alarm goes off and the timer expired? Thanks in advance to everyone who will help me, Marco.
1
0
1.1k
Aug ’23
Silent FCM Notification blocked by system
Hi! I've been working on app with Silent Background notifications using FCM and I'm facing some issue where system decides to block the receiving notification. In Console logs I get: com.apple.pushLaunch.<bundleId>:[{name: ApplicationPolicy, policyWeight: 50.000, response: {Decision: Absolutely Must Not Proceed, Score: 0.00, Rationale: [{[pushDisallowed]: Required:0.00, Observed:1.00},]}} ], FinalDecision: Absolutely Must Not Proceed}] It never proceeds in case of app being killed and another app in use. Is there a way to tell the system to proceed or to fix this somehow so we get the notification in such case and make didReceiveRemoteNotification to be called? Thanks!
1
0
440
Aug ’23
Notifications in Driving Task CarPlay app
I have an app with the "Driving Task" CarPlay entitlement. When I ask for permission for notifications in CarPlay (UNAuthorizationOptionCarPlay), and I check "carPlaySetting" in the UNNotificationSettings after granting permission, it get a value "UNNotificationSettingNotSupported" (the setting is not available to your app). Is this a bug? It feels like one. The app shows distances to some locations, and provides warnings to the user when approaching those locations. It is common for my users to use it at the same time they use a navigation app and switch between the two apps. But when they have the navigation app in foreground, they ask why my app is not showing notifications when giving an audio warning. The notifications are not even shown on the screen of the iPhone, the screen is turned off in iPhone 14 Pro when connecting to CarPlay, and the screen does not turn on when the app is in background in CarPlay and tries to show a notification.
3
1
1.6k
Aug ’23
I have problem with fcm flutter notification on ios
I have enabled developer mode in flutter app development. I am using Firebase Cloud Messaging to send notifications. everything works fine There is a notification coming to the normal app. But after a while I can no longer send notifications to the app. {"multicast_id":5417898622260949101,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]} The fcm device token doesn't seem to work. This caused me to request a new fcm device token. and after using it for a while, it came back like the first time Is this caused by the APN token being canceled? or caused by enabling developer mode to develop apps.
1
0
925
Aug ’23
Application will not be launched because it failed to report an incoming call too many times (or repeatedly crashed.)
Hi,I am developing iOS app which receives VoIP Push Notifications and next calls CallKit | Apple Developer Documentation to bring Incoming Call UI panel. From time to time however the app fails to start, with error as below logged into the device console:default 10:29:04.933753+0200 callservicesd Application will not be launched because it failed to report an incoming call too many times (or repeatedly crashed.) default 10:29:04.933836+0200 callservicesd VoIP push for app dropped on the floorMy question is: does anyone know if statistics about application crashes and/or "failed to report an incoming call" are stored locally on the device? Or perhaps collected on Apple servers and used for all instances of my app on all devices out there?In case of the first scenario - does anyone know how to reset this stats on the device, so the Push Notification will be starting the app again?In case the second scenario - is there any way to flag device to Apple server as "development" and have it excluded from the stats? So it doesn't affect "production" app instances out there?Any help and suggestions very much appreciated.Regards,Chris
3
0
2.1k
Aug ’23
silent push notifications on simulator
I'm working on an app that makes use of both regular (visible) push notifications and silent push notifications. Both types are working fine on a device, but only the regular type is working in the simulator. I'm sending the same test payloads to both the device and simulator. To be more specific, I use this payload for a silent push notification: { &#9;"aps": { &#9;&#9;"content-available": 1 &#9;}, &#9;"Simulator Target Bundle": "com.mycompany.MyApp" } And I try to send this payload to the simulator with this command: xcrun simctl push booted com.mycompany.MyApp silent.apns As far as I can see, the app in the simulator does not respond to this silent push notification, but the app on a device does when running both in the foreground and background. Is this a known issue? If so, has anybody been able to get this to work? Or are silent push notifications just not supported on the simulator (yet)?
3
3
3.3k
Aug ’23
Notification Content Extension failing to run on Mac
Hi, I'm trying to use UNNotificationContentExtension for a SwiftUI Mac application, and I'm unable to get it to run - the default notification type is displayed instead. I'm using Mac OS 12.6.7 and Xcode 14.2 To reproduce, create a new SwiftUI Mac application, and replace the contents of the ContentView body VStack with the following: Button("Request Permission") { UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { success, error in if success { print("All set!") } else if let error = error { print(error.localizedDescription) } } let notificationCategory = UNNotificationCategory(identifier: "test", actions: [], intentIdentifiers: []) UNUserNotificationCenter.current().setNotificationCategories([notificationCategory]) } Button("Schedule Notification") { let content = UNMutableNotificationContent() content.title = "Testing" content.categoryIdentifier = "test" content.sound = UNNotificationSound.default // show this notification five seconds from now let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.1, repeats: false) // choose a random identifier let request = UNNotificationRequest(identifier: "myApp", content: content, trigger: trigger) // add our notification request UNUserNotificationCenter.current().add(request) } Then do New->Target->Notification Content Extension. In the extension Info.plist, set UNNotificationExtensionCategory to 'test'. My understanding was that this should be enough to get the extension to load, but it doesn't seem to be. Am I missing something? Thanks in advance!
1
0
332
Aug ’23