In this screenshot, instead of the app logo only, there is a image of the person that messaged the user.
I think this is possible by using an INSendMessageIntent with an INPerson. Apple Wallet notifications however, use a similar design.
So should/can we use the INSendMessageIntent with an INPerson for non Message/Person related content? Or is there another way to achieve Apple-Wallets notification style?
User Notifications
RSS for tagPush 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
160 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
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?
From an MacOS Application, I want to listen for the arrival of push notification event for any app installed on the Mac system.
I understand, AppKIt provides API to listen for receiving push notification of that application. But, Is there any API, which can listen and just notify the developing app when a notification arrived for any apps installed on the system?
Hi there,
Our app is installed on tablets provided to customer workers for performing tasks. We're currently implementing Push Notifications using AWS SNS and FCM. The goal is to send data-only (silent) push notifications to trigger a function that creates a record in the app's local DB.
This approach allows us to control how the message is displayed in the foreground and background using Notifee. While this works well on Android in all states (foreground, background, killed), we're facing an issue on iOS, specifically in the release build.
The silent push notifications only reach devices when the app is in the foreground, not in the background or killed states. Normal push notifications work fine, but we require the ability to send silent notifications for better processing control. Upon researching, we discovered that Apple has strict guidelines for these notifications to prioritize user experience, battery usage, spam prevention, and privacy. However, in our case, the tablets are dedicated work devices with only our app installed.
Given this context, is there a reliable solution to send silent push notifications to iOS devices with the app in the background or killed states?
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.
I created a PWA that sends notifications via javascript to users, but the notifications arrive in this layout: Title, from {app name}, body. I would like to remove these "from", is it possible or only native applications have this control?
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:
I have a financial app which should work only when a the registered phone number is there in device, so after login to app and if the user removes the SIM, the app should indicate that the app will conitnue to work only if that particular registered phone number(SIM) is there.
Hi everyone.
I noticed that applicationIconBadgeNumber is now deprecated, if there is a new way to set this badge number with setBadgeCount(_:withCompletionHandler:) i don't see any new way to get the current value.
Does anyone know how to get the current value?
thanks
UNNotificationRequests with a UNLocationNotificationTrigger created using a CLBeaconRegion can be scheduled and are returned in the pending list when the getPendingNotificationRequests method is called on UNUserNotificationCenter.
However, they never trigger based on beacon region entry or exit.
This is a change in behavior from iOS 14.
I can't find any reference to this change in the WWDC21 presentations. Can anyone confirm if this change is intentional and documented anywhere or likely a bug.
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.
Hi,
We need to use silent notifications in our app, even when the user kills the app.
We requested Apple to get a NSE Filtering Entitlement on December 02, 2022 with follow-up number: 814879299
But after nearly 2 months, we still haven't got a response.
So we also sent a TSI (Technical Support Incident) on January 09, 2023 with follow-up number: 817249684. DTS (Developer Technical Support) said that we need to use this specific entitlement and he has no involvement in the entitlement request process.
We need a quick response for the NSE Filtering Entitlement because our business depends on Apple's response.
@Apple, is it possible to get an estimation date for the response?
@iOS_developers, how long have you been waiting for that permission?
Hey there,
Is there a way for an app to access the Standby settings listed below in iOS 17?
Standby
Night Mode
Show Notifications
Show Preview on Tap Only
The objective is determine whether the user has turned off the "Show Notifications" property, which could result in missing non-critical notifications.
Best Regards
When creating a new Multiplatform project on Xcode 14 beta and adding a Notification Service Extension Target, compilation fails with:
error build: Your target is built for macOS but contains embedded content built for the iOS platform (Notification.appex), which is not allowed.
This really limits the usefulness of the new multiplatform single target, especially if we cannot incorporate basic extensions.
Is there any way to use single target multiplatform and still have the freedom to add necessary extensions to the app?
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
}
}
}
Dear fellow developers,
I have an issue where my didReceiveRemoteNotification method in the AppDelegate is never called. Here's what I did:
I am developing a SwiftUI application for iOS 15 and 16 and am currently running tests in an iPhone 14 Pro Simulator. My Xcode version is 14.2 and the simulator is running iOS 16.2.
I am of course talking about the AppDelegate's application:didReceiveRemoteNotification:fetchCompletionHandler: method, not the deprecated one.
I embedded the AppDelegate in the following way:
@main
struct MyApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
...
}
The integration of my AppDelegate does work in general, meaning the didFinishLaunchingWithOptions is called.
I added the background modes capability to my app, including both "Remote notifications" and "Background processing".
With this configuration, I would expect the AppDelegate's method to be called. I tried sending different push notifications with different payloads and headers while having the app both in the background and foreground but without success.
Just to rule out mistakes on my side that are obvious to someone else, this is how I embedded the method into my AppDelegate:
class AppDelegate: UIResponder, UIApplicationDelegate {
...
func application(
_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable: Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
) {
print("Method called!")
completionHandler(.noData)
}
}
And here are a few payloads and headers that I tested. I tried all of the following payloads with the following headers in any combination.
apns-push-type=alert or apns-push-type=background
apns-priority=5 or apns-priority=10
Example 1: Visible notification
{
"aps": {
"alert": {
"body": "Test"
},
"badge": 1,
"content-available": 1
},
"test": "data"
}
Example 2: Silent notification without badge update
{
"aps": {
"content-available": 1
},
"test": "data"
}
Example 3: Silent notification with empty alert block and badge update, based on ideas from this thread
{
"aps": {
"alert": {},
"badge": 0,
"content-available": 1
},
"test": "data"
}
As I said, no matter whether my app is in the foreground or background, the method is never called. At the same time, the userNotificationCenter(_:willPresent:withCompletionHandler:) method of the UNUserNotificationCenterDelegate is called when the app is in the foreground. At this point, I am running out of ideas what I could possibly be doing wrong, so I hope someone else has an idea what else to try.
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
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.
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
What is Settings app -> Safari -> Advanced -> Experimental Features -> Push API for?
I thought it would be possible to receive WebPush on Safari, but it didn't work.
Also, I thought it was a setting related to WebPush, which operates when a PWA-compatible site is added to the home screen, but I was able to receive it regardless of this setting.
Thank you,