hi, I am trying to schedule a UNNotificationRequest at a certain date using UNCalendarNotificationTrigger, and I also want to update the badge count accordingly. However the badge property in UNNotificationContent can only be set when adding UNNotificationRequest, not when the trigger is fired or notification is actually delivered. How can I set up-to-date badge count if notification is scheduled in the future?
For example, if I scheduled notification A to 3 hours later with badge count 1, and in between I got notification B, badge count should be 2 when A is delivered but it will be 1.
I am aware of didPresent delegate which can be used when app is in foreground when notification is delivered, but is there any delegate that is called when UNNotificationRequest is delivered and app is backgrounded or we are using NSE? Thanks.
Notification Center
RSS for tagCreate and manage app extensions that implement Today widgets using Notification Center.
Posts under Notification Center tag
57 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
How can I observe notifications triggered by scanning NFC in backgroundMode, I want to customize notifications, add Gif or Image to notification content. because the merchants want to display their images when shopper take their iPhone near goods.
how can I customize local notifications contains GIF when my app scanning NFC tags and get different data from NFC tags.
Can you change the size of a control Center Widget like for normal Widgets(.supportedFamilies([...]))?
I would also like to add a slider like Apples brightness. Is that possible?
Potential Apple Pay Notification Delay in iOS 18 Developer Beta
Users are reporting a delay in receiving purchase notifications in Apple Wallet after using Apple Pay. Transactions are confirmed within the Wallet app, but the notification arrives hours later.
As this issue is occurring on the iOS 18 developer beta, it's likely a software bug related to Apple Pay integration with Wallet.
I have reported this to Feedback.
Is anyone else having the same problem?
Hi,
I have a question regarding the badge in push notifications. I am implementing the following code to set the badge to 0 in order to remove it from the app:
swift
if #available(iOS 16, *) {
let center = UNUserNotificationCenter.current()
center.setBadgeCount(0)
} else {
application.applicationIconBadgeNumber = 0
}
When I call setBadgeCount(0), the badge disappears, but the notifications in the Notification Center remain. On the other hand, when I call application.applicationIconBadgeNumber = 0, the badge disappears and all notifications in the Notification Center are cleared. Additionally, if no badge is displayed, calling application.applicationIconBadgeNumber = 0 does not clear the notifications in the Notification Center.
Is this behavior expected?
If it is expected, is there a way to call setBadgeCount(0) and clear all notifications in the Notification Center? Also, is there a way to call application.applicationIconBadgeNumber = 0 without clearing the notifications in the Notification Center?
Hey Team,
We're experiencing an issue where push notifications are failing to deliver to certain devices in the production environment. However, they are working fine in the development build on specific devices. Interestingly, the notifications are working fine for a few devices in the same production environment.
In the affected devices we have attempted the following things to resolve the issue
Verify the device token (& send the notification through apple push notification console)
reinstall the application
reboot the device
Below are the device details
Model - Macbook Pro 15-inch, 2018
processor - 2.9 GHz 6-Core Intel Core i9
OS Version - macOS Sonoma 14.2.1
I have attached the APSD process console log for the affected device. In which we are getting following error.
apsd Peer connection [pid=472] lacks APSConnectionInitiateEntitlement
APSD_ConsoleLog.txt
Thank you all in advance for any information regarding this issue and we will provide any additional information if needed.
I am building an application where I need to implement a use case where a local notification is set for a specific date / time (e.g 05/6/24 8 PM) to display to the user (e.g. "Take your Meds") and I want him to continue to get that alert every X minutes (e.g. every 2 minutes) until I cancel it (e.g. when the user indicates he has taken his medicene).
NOTE: I do NOT want to rely on push notifications from the server for doing the reminders because it needs to work when the device is off the network (like on a plane or a cruise ship in the middle of the ocean or whatever).
This would seem to be a pretty common use case, but looking at the previous and existing local notification frameworks, I only see the option to create a calendar based trigger with a boolean repeat (UNCalendarNotificationTrigger) or a time interval based trigger with a boolean repeat (UnTimeIntervalNotificationTrigger), but nothing that combines these in a way that allows me to implement the above stated use case.
We are attempting to enable provisional notifications in our app, but some internal users on iOS 17 are reporting that they are not receiving the "Keep" and "Turn off" buttons that provisional notifications are supposed to have - in other words they just come in as regular quiet notifications.
I have confirmed that these users are doing a fresh install of our app, and at no point are they ever receiving a permission prompt to turn on notifications. Their UNAuthorizationStatus is correctly being set to provisional. Their notification settings are being set to the following, which seems correct:
I have not been able to reproduce this issue on any of my own devices, but these users can do so consistently. What could possibly cause this? Some misconfiguration on our end, our some hidden iOS setting somewhere?
I schedule a local notification to remind me to check in at work at 8 am if I am not already checked in, the code is working fine when app is in foreground, but when I kill the app, it alway show alert no matter if I already checked in or not.
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let isCheckedIn = AppManager.shared.isCheckedIn()
if isCheckedIn {
completionHandler([])
} else {
completionHandler([.list, .sound, .banner])
}
}
I have a bundled application that contains a widget extension. On launching the application once the widget appears in the widget gallery, However, I have observed that If my widget extension is not sandboxed, the widget fails to show in the widget gallery. Is this expected? I am using the same xcode project and just that AppSandbox capability for the widget extension target is causing this. Can someone please explain why is this happening?
How can we identify whether the remote change notification is triggered because some data was changed on a different device and it is downloaded from CloudKit, or it is triggered from the current device because new entity was saved into database.
Because this notification is posted when both remote data is downloaded or local data is created. It would be great if there is a way to understand the origin of the notification.
Dear Apple support,
We are working on one of the projects related to BLE, in which our BLE device is acting as a GATT client and our iPhone device (iPhone 13, OS17.3) is acting as a GATT server.
Issue being faced: Whenever my BLE device subscribes to the ANCS notifications, and the moment the IOS device starts bombarding with the notifications available in notification center, the BLE device controller's heap memory becomes UNAVAILABLE in runtime for this notifications' queue and eventually making the BLE controller to reset. Thereafter, whenever user tries making a new connection session of BLE, again same thing repeats.
Notifications allowed in BLE display : W-SMS, W-CALL, SMS, CALL, none other than this.
Issue observed with : IF and ONLY 150 notifications and above available in notification center, otherwise our product works fine with iPhone with less number of notifications.
We would like to know how we can curb the number of PRE-EXISTING type notifications available in the notification center flowing towards the BLE device? What best solution can be done at the IOS side, we also have IOS APP team for this project. What kind of APIs does Core Bluetooth framework can provide to the IOS developer in order to overcome this issue.
Please suggest possible ways from the IPHONE device only to overcome this. BLE's software CANNOT BE CHANGED under any circumstances as the product is already in production and complaints are coming from end user (from the field).
OUR GOAL : ONLY notifications which will be available in run time, i.e. AFTER SUCCESSFUL BLE connection established to be displayed in the BLE's display. We DON'T WANT older notifications to be displayed and flow towards BLE over ANCS. WE MUST make 'notification popup' option as ALLOW to be shared with our BLE device, otherwise SMS,CALL, W-SMS,W-CALL during live connection will not come on the BLE 's display.
The Notification provides the uuid corresponding to the Item saved in SwiftData.
Goal is to open the correct DetailItem View when I tap the notification.
How can I achieve this?
@Model
final class Item {
@Attribute(.unique) var uuid: UUID
...
}
--
extension LocalNotificationManager: UNUserNotificationCenterDelegate {
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
guard let userInfo = response.notification.request.content.userInfo["uuid"] as? Data else {
print("No data found in notification userInfo")
return
}
}
--
struct ItemList: View {
@Query var items: [Item]
@State private var path = NavigationPath()
var body: some View {
NavigationStack(path: $path) {
ForEach(Array(items.enumerated()), id: \.element.id) { index, item in
NavigationLink(value: item) {
ItemButton(item: item, index: index)
}
}
}
}.navigationDestination(for: Item.self) { item in
DetailItem(item: item)
}
}
Both the extension and the receiving application are in the same app group.
I can't find the issue. It doesn't seem to be a problem with entitlements. Maybe an issue with the string formatting/conversion? Maybe I am not allowed to send distributed center notifications from the camera extension?
I am sending the notification calling:
func notifyChangeInUsage() {
os_log("Notifying the virtual camera change in usage", log: cdsLog, type: .info) // this is logged
DistributedNotificationCenter.default().postNotificationName(NSNotification.Name("VirtualCamUsageChanged"), object: nil, userInfo: nil, deliverImmediately: true)
}
And receiving it in the other end, subscribing with
std::string notification = "VirtualCamUsageChanged"
[mObserverClassInstance subscribe:@(notification.c_str())];
where subscribe is the following method, which is tested to be working.
- (void)subscribe:(NSString *)notification {
[[NSDistributedNotificationCenter defaultCenter]
addObserver:self
selector:@selector(callCallback:)
name:notification
object:nil
suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];
}
Dear Apple support,
We are working on one of the projects related to BLE, in which our BLE device is acting as a GATT client and my iPhone device (iPhone 13, 17.3) is acting as a GATT server.
Issue being faced: Whenever my BLE device subscribes to the ANCS notifications, and the moment the IOS device starts bombarding with the notifications available in notification center, the BLE device controller's heap memory becomes UNAVAILABLE in runtime for this notifications' queue and eventually making the BLE controller to reset. Thereafter, whenever user tries making a new connection session of BLE, again same thing repeats.
Notifications allowed : W-SMS, W-CALL, SMS, CALL, none other than this.
Issue observed with : 150 notifications and above available in notification center, otherwise our product works fine with iPhone.
We would like to know how we can curb the number of PRE-EXISTING type notifications available in the notification center flowing towards the BLE device?
What best solution can be done at the IOS side, we also have IOS APP team for this project.
What kind of APIs does Core Bluetooth framework can provide to the IOS developer in order to overcome this issue.
Please suggest possible ways from the IPHONE device only to overcome this. BLE's software CANNOT BE CHANGED under any circumstances as the product is already in production and complaints are coming from end user (from the field).
OUR GOAL : ONLY notifications which will be available in run time, i.e. AFTER SUCCESSFUL BLE connection established to be displayed in the BLE's display. We DON'T WANT older notifications to be displayed and flow towards BLE over ANCS.
WE MUST make 'notification popup' option as ALLOW to be shared with our BLE device, otherwise SMS,CALL, W-SMS,W-CALL during live connection will not come on the BLE 's display.
Hi, Team.
I use old widget(Today Extension) to show some info to users, but when my app had got updated , the widget missed and can't find it in today gallery. I see lot's of apps have same issue, is this a system bug?
Thanks you for your reply.
I have a question about APNs specifications.
We are aware that if we delete the app, we will disable the device token managed by APNs. we intend to send a push notification from AWS SNS to APNs and if the device token is disabled, AWS SNS will identify that the app has been deleted from our phone.
I believe the specification is that iOS uninstall data is only available after the 8th day.
However, it has been a month since the uninstallation and still the APNs are not returning the device token as invalid.
Why is the uninstall data not available?
If there is a way to do this waiting up, please let me know.
Hi All
I have some customer sound file named as .x-wav / .x-m4a, when specify sound file with extension .x-wav, like
content.sound = [UNNotificationSound criticalSoundNamed:@"mysound.x-wav" withAudioVolume: 1.0];
it will play defaultcrititicalsound.
if I tried
content.sound = [UNNotificationSound criticalSoundNamed:@"mysound.wav" withAudioVolume: 1.0];
then it worked
Hi. I would like my App to be notified when the phone rings. No, not CallKit-CallKit is for VoIP and does not cover Cellular connections (as of 2/26/24) but, thanks. To continue..
I understand ages-ago there was a Telephony Kit or Framework but, has been discontinued. Has it been replaced with something else?
I would like something that seems very simple:a) when the phone rings my App is notified, b) when it stops ringing (combine all possibilities; sent to voicemail, user cancels, user answers) my App is notified.
Yes, I understand UserNotifications can make things run but, as I understand it this feature is for the App to schedule notifications, not receive them? If you know of something in UserNotifications that I can leverage I would appreciate your input.
Lacking other possibilities I find myself wondering about Siri integration. Siri is notified about system events and generates notifications based upon these events. Is there some way to place my App downstream from Siri and receive system notifications? Thanks everyone.