Please find below a complete app example.
It has a button, when you press it, a local notification is created. However, the UnNotificationCenter.delegate is called twice, and I can't understand why.
I am trying to move my project from Objective-C to Swift, and my similar code there doesn't get called twice, so I'm confused.
Can anybody shine a light on this? Pointers appreciated.
App:
@main
struct NotifTestApp: App {
init() {
UNUserNotificationCenter.current().delegate = NotificationReceiveHandler.shared
configureUserNotifications()
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
private func configureUserNotifications() {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, error in
if granted {
print("Notification permission granted.")
} else if let error = error {
print("Error requesting notification permissions: \(error)")
}
}
}
}
class NotificationReceiveHandler: NSObject, UNUserNotificationCenterDelegate {
static let shared = NotificationReceiveHandler()
//>> THIS IS CALLED TWICE WHEN I PRESS THE BUTTON
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
NSLog(">>> Will present notification!")
completionHandler([.sound])
}
}
///THE UI
struct ContentView: View {
var body: some View {
VStack {
Text("👾")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Notification test!")
Text("When i press the button, will present is called twice!!").font(.footnote)
.padding(10)
Button("Create Notification") {
createNotification(
message: "This is a test notification",
header: "Test Notification",
category: "TEST_CATEGORY",
playSound: true,
dictionary: nil,
imageName: nil)
}
.padding()
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(8)
}
.padding()
}
}
#Preview {
ContentView()
}
private func createNotification(message: String, header: String, category: String, playSound: Bool = true, dictionary: NSDictionary? = nil, imageName: String? = nil) {
let content = UNMutableNotificationContent()
content.title = header
content.body = message
content.categoryIdentifier = category
content.badge = NSNumber(value: 0)
if let imageName = imageName, let imageURL = Bundle.main.url(forResource: imageName, withExtension: "png") {
do {
let attachment = try UNNotificationAttachment(identifier: "image", url: imageURL, options: nil)
content.attachments = [attachment]
} catch {
print("Error creating notification attachment: \(error)")
}
}
content.sound = playSound ? UNNotificationSound(named: UNNotificationSoundName("event.aiff")) : nil
if let infoDict = dictionary {
content.userInfo = infoDict as! [AnyHashable: Any]
}
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
}
Notifications
RSS for tagLearn about the technical aspects of notification delivery on device, including notification types, priorities, and notification center management.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Excited for AlarmKit! I have found two concerns that I cannot find answers for though.
The volume of my alarms seems to be very quite relative to the full volume capability of the device. For example, if I turn the volume all the way up and play the audio file, the sound is very loud. However then, if I set the alarm using alarm kit with the same audio, the track played during the alerting phase is not that loud. I am afraid that it will not be loud enough in real life. Will there be future support to set the volume level of the alarm to maximum settings?
When I press the volume buttons (with the app open) during an active alarm, the audio stops, but the alarm manager does not clear these events. The alarm manager does clear the alarm event if the alarm is stopped through a live activity.
Topic:
App & System Services
SubTopic:
Notifications
If a server is sending a push to an app, then how can it know whether it should be sending the push using the Apple sandbox push server, or the production server?
If the app is on the app store or testflight then it needs to be using the sandbox server, but if the app is being run via XCode interactively as devs are developing/testing then the push needs to be sent via the sandbox server.
But the server itself has no idea if the app was installed via Testflight/app store/XCode/ or a development .ipa. So the server can't know how to send the push.
The app has to send the push token to the server anyway, so the app could inform the server which environment it should be sent over. But then how can the app detect that itself?
A naive answer is to use #ifdef DEBUG to detect this, but that is incorrect. Which environment a push should be sent over is not correlated with that. For example an app could be being run with a debug scheme or a release scheme, but in both cases if the app is installed/running via xcode then the push environment has to be the sandbox.
So my question is, is there a way the app can detect which push environment a push should be sent over in order than it can instruct the server accordingly?
In the new AlarmKit API, how do you localize NSAlarmKitUsageDescription?
In the case of other usage descriptions, such as NSLocationWhenInUseUsageDescription, you can use an InfoPlist.xcstrings file, but this does not appear to work for NSAlarmKitUsageDescription.
Topic:
App & System Services
SubTopic:
Notifications
I have set up an iOS application with CarPlay scene using carplay-driving-tasks entitlement. And as per latest policy changes I'm able to get push notifications in the CarPlay screen. But unlike from phone scene, when I tap on a notification from CarPlay I don't get a trigger on didReceive method to intercept the payload of the notification that user tapped on. Is there any other ways or configuration needed to get this working?
I just need to get the payload and present an Alert template within the CarPlay when user taps on a CarPlay notification and the app opens.
Topic:
App & System Services
SubTopic:
Notifications
Tags:
APNS
CarPlay
Notification Center
User Notifications
When setting a custom sound in AlarmKit, the alarm only plays the audio file once. I can understand why push notifications would play a sound only once, but I don’t understand why alarms can only play the sound for less than 30 seconds. We’re already at beta 6, so I’m wondering if Apple still hasn’t fixed this or if they have no intention of fixing it.
Topic:
App & System Services
SubTopic:
Notifications
Hello everyone,
I’m working with AlarmKit (iOS/iPadOS 26) and encountering a critical blocker. On the simulator, after adding NSAlarmKitUsageDescription to Info.plist, AlarmKit functions as expected—no entitlement issues. However, when building to a physical device, Xcode fails with:
“Provisioning profile … doesn’t include the com.apple.developer.alarmkit entitlement.”
The core issue: there is no AlarmKit capability visible under App ID settings or provisioning profiles in the Developer Portal. Thus, this entitlement cannot be enabled or included in a profile.
Steps taken so far:
Reviewed WWDC25 AlarmKit session and documentation.
Reviewed Apple Developer documentation on entitlements and provisioning.
Verified there's no AlarmKit toggle or capability in the Developer Portal (Certificates, Identifiers & Profiles > Identifiers).
Submitted multiple Feedback requests via Feedback Assistant, but received no technical resolution.
Questions:
Is there meant to be a separate AlarmKit entitlement (distinct from Critical Alerts)?
If so, when will the com.apple.developer.alarmkit entitlement option be available in the Developer Portal?
In the meantime, how can developers test AlarmKit-based features on physical devices?
Could an Apple Engineer advise on whether an internal entitlement workflow or workaround exists for testing?
Thank you in advance for any clarity anyone can provide. I'm stuck at a total impasse until this is resolved.
—John
Current Project Configuration Relevant Parts:
info.plist:
NSAlarmKitUsageDescription
Schedules system-level alarms that break through Do Not Disturb and Focus modes to ensure alarms trigger reliably.
UIBackgroundModes
audio
background-app-refresh
location
remote-notification
entitlements.plist
aps-environment
development
com.apple.developer.icloud-services
CloudKit
com.apple.developer.alarmkit
com.apple.developer.usernotifications.time-sensitive
Topic:
App & System Services
SubTopic:
Notifications
Howdy,
I'm trying to figure out how to replicate the following behavior for our app:
The system is able to ascertain that the Mac equivalent of some iOS app is installed locally, and it prevents notifications from being mirrored. However, I am unable to determine how this association is inferred. When I check our iOS app under this prefpane, the switch remains enabled and toggleable—we'd like to act like Slack here.
My initial assumption is that an app group containing both the Mac and iOS apps can be used to create the association; however, I would like to confirm that this is indeed the case before doing so. I'm not terribly confident about this.
Details:
The bundle identifiers of both apps do not match. This also applies to Slack; its iOS app is com.tinyspeck.chatlyio while its Mac app is com.tinyspeck.slackmacgap.
In our case, the iOS app's identifier is like com.company.app while the Mac app's identifier is com.company.app.desktop.
Both apps are signed with certificates that have matching team identifiers. The com.apple.developer.team-identifier entitlement is present on the Mac app.
The Mac app shares a keychain access group with the iOS app.
The Mac app is not sandboxed.
The Mac app is an Electron app.
The Mac app does not use APNs. It sends notifications "locally".
I currently only have the iOS app installed on my iPhone via TestFlight, if that matters.
Notification mirroring does work, but we'd like to forcibly disable this by associating the apps together.
To my knowledge, the iOS app makes use of both a UNNotificationServiceExtension and a UNNotificationContentExtension.
The iOS app currently doesn't have an assigned category (at least in Xcode). The Mac app is currently miscategorized as a developer tool (LSApplicationCategoryType = "public.app-category.developer-tools";), but that should be fixed.
(Redacted) bundle information for the Mac app:
CFBundleDisplayName = App;
CFBundleExecutable = "App Desktop";
CFBundleName = App;
Note that our CFBundleExecutable differs from the bundle's display name/name because we're currently migrating our users to a new version of the app that they'd likely want to live alongside the new one. The filename of the bundle itself is, similarly, App Desktop.app.
For the iOS app, to my knowledge, the CFBundleName and CFBundleDisplayName are App.
I've built an app that supports live activities, but when trying to build and deploy I'm getting the error:
Provisioning profile "iOS Team Provisioning Profile doesn't include the com.apple.developer.live-activity entitlement."
Looking in Xcode - under signing and provisions, there is no "Live Activity" option to select.
Looking in the developer portal, similarly under Certificates, Identifiers & Profiles, there is no "Live Activity" option.
I've added com.apple.developer.live-activity to my entitlements file for both my widget and my main app target, and added NSSupportsLiveActivities to my info.plist files.
I'm building on Xcode Version 16.0
Any ideas on how to fix this? Super confused!
Thanks in advance!
I am looking for advice for debugging a wallet pass not updating for some customers after successfully posting an APNS notification (pass identifier as topic, no expiration, priority 10).
Is there an exhaustive list of reasons for a wallet pass not updating or a guide for making sure updates happen reliably? Are there are any guarantees made as to when the pass is updated? We noticed it is either never updating or the update happens much later for some customers. Usually toggling "Automatic Updates" in Pass Details updates the pass immediately for affected customers.
Can it be caused by an error in the implementation of the Wallet Passes Web Service? We generate passes on the fly as a response to /v1/passes/{passTypeIdentifier}/{serialNumber}. I noticed that we also sometimes receive HEAD requests to this endpoint despite the documentation only mentioning the GET method. I was previously returning a HTTP status code 405 (Method Not Allowed). I have now updated it to also respond with headers (Content-Type, Content-Disposition and Last-Modified) for the pass for HEAD requests, but I don't know if it makes a difference.
Here is a list of issues on the customer side I was thinking of:
No connection to the internet
Low power mode (does it prevent or throttle updates?)
What happens if there is an error? Does it keep trying or does it just fail silently? In the latter case it might make sense to keep sending APNS notifications until the pass is requested successfully.
I know that you can use the PassKit framework in iOS apps to update (replace) passes. Would this be more reliable than a stand-alone Wallet pass?
I created new APNS key, when i clicked on download, this is the error am getting:
Download Failed
Auth Key can only be downloaded once. This auth key has already been downloaded.
I dont have any key before and i have not downloaded the key before, it just a new key, i just created.
Please this is affecting the release of our client app, and the client is having negative thought concern our service not knowing it from you guys.
Hi there, we noticed high volume of 410 responses from APNs.
It started on July 19th and we see it across multiple apps. Is there some sort of mass token invalidation/removal that's happening on APNs?
Hello,
I'm using Apple Wallet passes with a custom backend for distributing and updating them, as described in the documentation (https://developer.apple.com/documentation/walletpasses).
I'm sometimes seeing a behaviour where the device does not download an updated pass even though the push notification for informing about the changes has been successfully sent (I've received a success response from APNs).
APNs documentation says that it should retry sending the notification if the device is not reachable, but in the cases I'm describing here, the request from the device to fetch the updated pass never arrives. I don't have the apns-expiration header set. Also, I've checked the load balancer and firewall logs, etc. and there are no traces of the requests.
Any thoughts on what might be the issue here? Or how to debug this further?
Observations:
When our app calls the APNs API for push notifications, we observed significant fluctuations:
July 15-25: The success response volume increased by 20% compared to the baseline before July 15.
After July 25: Success rates returned to baseline levels.
July 30: Success response volume decreased by 10% compared to the pre-July 15 baseline.
Excluded Factors:
No changes in target audience size or characteristics (business factors ruled out).
Server logs confirm consistent API request parameters and frequency.
Key Questions:
Were there any adjustments to response metrics (e.g., success status code definitions) during this period?
Have other developers reported similar issues?
Were there server-side configuration updates or known incidents on Apple’s end?
Topic:
App & System Services
SubTopic:
Notifications
Tags:
APNS
App Store Server Notifications
User Notifications
I'm running into an issue during the iOS build process for my app, and I'm hoping someone can point me in the right direction.
❗ The Problem
When attempting to archive the app via EAS Build (Expo), the build fails with the following error:
`Provisioning profile "HCF_AppStore_ProvisioningProfile" doesn't include the com.apple.developer.push-notifications entitlement. Profile qualification is using entitlement definitions that may be out of date. Connect to network to update.`
What I’ve Already Done:
Enabled Push Notifications capability for the App ID (com.rsmco.helpcreatefamilies) in the Apple Developer portal.
Deleted and regenerated the App Store Provisioning Profile after enabling the capability.
Confirmed the new profile is associated with the correct App ID and Distribution Certificate.
Uploaded the new profile to EAS (Expo) and rebuilt the app.
Yet the error persists during the Xcode archive step with Exit code 65.
Additional Info:
Provisioning Profile Name: HCF_AppStore_ProvisioningProfile
App ID: com.rsmco.helpcreatefamilies
Team: Reproductive Sciences Management Company, LLC
Workflow: Expo EAS Build
Capability causing issue: com.apple.developer.push-notifications
Dear Apple Engineer
Recently we found that our push delivery rate has decreased. On the website "https://icloud.developer.apple.com/dashboard/notifications/teams/43Y657P48S/app/com.taobao.fleamarket", we found that starting from January 8, 2025, "Discarded - Token Unregistered" showed an upward trend, from millions to tens of millions.
We have not found the reason, and hope you can help us.
Team ID: 43Y657P48S
Bundle ID: com.taobao.fleamarket
Here are some failed tokens, in "Device Token Validator" The query is valid, but the user cannot receive the message:
56025f656cc3aa701898037f59e8d0cb937263ff5585cd1cec9ae661dcc15b19
5fbbd1e604d3662d7583e9377676f8fa276005145278d6dea04b4fc85a7b070e
f0970602551f8d249d8f97960a74006ad78688b52fec6b0d19a585 207caff62e 9388fb40209c100afc2db728342f6fe86c7e34787a8fe4a92b73d2503c5286e0 a2819a4708462588b07452ed827d9afb03c343b586e70dcb67a9981f76295704 8949373cd43783fa3e23d38d55ee1fd72475b39f9c2d2fedca3ecb925b094240
Best Regards!
I need to create a background notification that counts down time and uses buttons to add or subtract time. Currently, I'm developing in React Native and using Expo Go to develop my app.
I managed to display a simple notification, but I can't get it to work in real-time, so that when the time is up, it emits a sound indicating that the break is over.
How can I implement this feature?
My application now:
My goal:
Hello Apple Developer Community,
We’re building an MDM product (SaaS, multi-tenant). I’d like clarification on the APNs MDM push certificate usage model for service providers (MSPs).
Question:
Is it acceptable for an MDM vendor to use a single APNs MDM push certificate owned by the vendor to manage devices for multiple, independent customer organizations?
Or is it required/recommended that each customer (company) must obtain and use its own APNs MDM push certificate (issued under the customer’s Apple ID) for their tenant?
Why we’re asking:
We understand that many guides show the process where each customer logs into the Apple Push Certificates Portal with their own Apple ID, uploads a CSR provided by the MDM, and then renews yearly.
Practically, for a small team and early-stage deployments, using one vendor-owned certificate across multiple tenants would be simpler.
We want to ensure we’re not violating any policy, terms, or technical requirements (e.g., certificate ownership, topic binding, device token isolation, audit/compliance expectations).
What we need from Apple (or authoritative sources):
An official Apple document or policy that clearly states whether per-customer certificates are mandatory vs strongly recommended for MSP/multi-tenant MDMs.
If per-customer is mandatory, please point to the relevant clause or section.
If a vendor uses a single certificate for multiple organizations, what risks or consequences should we expect (e.g., compliance issues, supportability, potential program violations, off-boarding problems, etc.)?
Context:
We’re sending only MDM wake notifications (standard MDM flow).
We understand certificates expire yearly and must be renewed with the same Apple ID to avoid device re-enrollment.
We want to follow Apple’s best practices while keeping early operations manageable.
Any guidance, links to official documentation, or clarification from Apple engineers/moderators would be greatly appreciated.
Thank you!
Topic:
App & System Services
SubTopic:
Notifications
Tags:
APNS
Apple Business Manager
Device Management
I'm experiencing a critical regression on iOS 26 with a Notification Content Extension. extensionContext.open(uri) fails to open external URLs with LSApplicationWorkspaceErrorDomain Code=115 under specific conditions.
Problem:
When the main app is killed, and a rich push notification is received and expanded, tapping a button (specifically one with a transparent background, cornerRadius=0, clipsToBounds=false) fails to open its associated URL.
Key Details:
iOS 26 Only: Works perfectly on iOS 17, 18, etc.
App Killed State Only: Works if the app is running (foreground/background).
Works on Subsequent Notifications: The link will open if a second notification is received.
LSApplicationQueriesSchemes: Confirmed to be correctly configured in the main app's Info.plist and present in the app bundle.
Delay No Help: Adding a 1s delay before open(uri) does not fix it.
My os_log statements confirm the button tap
Hi team,
I am developing VOIP feature using PushKit and CallKit but CallKit is not show when app in background or terminate state, now in foreground state I can call reportNewIncomingCall from pushRegistry-didReceiveIncomingPushWith and it's work as expected but the problem is in background or terminate state it's not
my setup:
PushKit is configured
In Signing & Capabilities I add background modes (Remote notifications and Voice over IP)
In info.plist I add
<key>UIBackgroundModes</key>
<array>
<string>voip</string>
I'm not sure should I create new VOIP Certificate but now I can receive message notification normally.
Any help or suggestions would be greatly appreciated
Thank you