We are currently developing a WebAPI service that uses APNs (HTTP/2) to send push notifications to iOS devices.
(Using PushSharp's HTTP/2 support)
The WebAPI service is running on IIS using .net framework 4.8 and c#.
The connection to APNs is always maintained, and the connection is checked every 30 minutes using a dummy token Ping.
KeepAlivePeriod = 30 minutes and KeepAliveRetryPeriod = 10 seconds have also been set.
However, the following issues are occurring.
Although the Ping sent immediately before was successful, a TimeoutException occurs in the notification request sent a few minutes later.
There is no explicit disconnection notification from APNs, and the connection appears to be silently disconnected.
Once a TimeoutException occurs, it occurs frequently afterwards.
Below is an excerpt from the log.
Apple Notification Failed for some unknown reason 1-1: One or more errors occurred.
Apple Notification Failed for some unknown reason 1-2:System.TimeoutException: The operation timed out.
In light of this issue, I would like to be advised on the following two points.
Are there any official specifications regarding the lifecycle and expiration date of APNs HTTP/2 connections?
Even if pings are sent periodically, is there a timeout or other setting that disables the connection on the APNs side?
What are the conditions that would cause APNs to silently terminate a connection?
For example, could this be due to inactivity, TLS restrictions, network maintenance, etc.?
If you have any official documentation or technical guidelines to improve the reliability of this system, we would appreciate it if you could share them with us.
Thank you in advance.
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
148 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hi! My project has the Local Push Connectivity entitlement for a feature we have requiring us to send low-latency critical notifications over a local, private Wi-Fi network.
We have our NEAppPushProvider creating a SSE connection using the Network framework with our hardware running a server. The server sends a keep-alive message every second. On an iPhone 16 with iOS 18+, the connection is reliable and remains stable for hours, regardless of whether the iOS app is in the foreground, background, or killed.
One of our QA engineers has been testing on an iPhone 13 running iOS 16, and has notice shortly after locking the phone, specifically when not connected to power the device seems to turn off the Wi-Fi radio. So when the server sends a notification, it is not received. About 30s later, it seems to be back on. This happens on regular intervals.
When looking at our log data, the provider does seem to be getting stopped, then restarted shortly after. The reason code is NEProviderStopReasonNoNetworkAvailable, which further validates that the network is getting dropped by the device in regular intervals.
My questions are:
Were there possibly silent changes to the framework between iOS versions that could be the reason we're seeing inconsistent behavior?
Is there a connection type we could use, instead of SSE, that would prevent the device from disconnecting and reconnecting to the Wi-Fi network?
Is there an alternative approach to allow us to maintain a persistent network connection with the extension or app?
Topic:
App & System Services
SubTopic:
Networking
Tags:
Extensions
Network
User Notifications
Network Extension
Hello,
We are currently facing a persistent issue where Apple Push Notifications (APNs) are no longer being delivered to devices. This is not an intermittent problem — push notifications have completely stopped working. We are using PushSharp.Apple (Version 4.0.10.0) to send the notifications.
Current Behavior (Failing):
Every notification request appears to be processed successfully from the server side.
However, the APNs client receives a 0-byte response, and the server closes the connection.
Devices do not receive the notifications at all.
Logs from Current (Failing) State:
APNS-Client[1]: Connected (Batch ID=1)
APNS-Client[1]: Sent Batch, waiting for possible response...
APNS-Client[1]: Received 0 bytes response...
APNS-Client[1]: Server Closed Connection...
APNS-Client[1]: Disconnected (Batch ID=1)
For Reference – Successful Log From Earlier (When Notifications Worked):
APNS-Client[1]: Connected (Batch ID=1)
APNS-Client[1]: Sent Batch, waiting for possible response...
APNS-Client[1]: Received -1 bytes response...
Push Notification Successfully Sent to Device
Any help, suggestions, or experience with similar issues would be greatly appreciated.
Thanks!!!
We are reaching out to report a critical issue we are facing with Apple Push Notification Service (APNs) for our application. Since yesterday, push notifications have stopped working, and we are consistently encountering connection reset errors when attempting to connect to Apple’s push notification servers.
The issue specifically involves the following endpoints:
gateway.push.apple.com – 17.188.170.74
feedback.push.apple.com – 17.188.178.87
These connections were functioning properly until yesterday. No changes have been made on our end, and we have verified our server configurations.
We kindly request your assistance in investigating this matter. Please confirm whether there are any known issues or restrictions related to the above IPs or endpoints that could be affecting our service.
This issue is impacting our production environment and affecting user experience, so your prompt support would be greatly appreciated.
requestUrl:https://api.storekit-sandbox.itunes.apple.com/inApps/v1/notifications/test
method:Post
responseCode:200
testNotificationToken:06beba6c-7587-44f6-a4b8-f12b11db6061_1745832671126
Request environment:
①APP from: TestFlight
②Apple acount : Sandbox account
③Apple originalTransactionId: 2000000907966801
App Store sandbox server notification configuration is fine(https://*.com/v2/apple_refund_notify), I have tried many times, but have not received any notification from Apple. Is this API not working?
Topic:
App & System Services
SubTopic:
Notifications
Tags:
App Store Server Notifications
User Notifications
We are observing an weird behaviour where a user uninstalled the app back in February (more than a month ago) but APNs is still accepting push notifications are returning success responses.
We know that using APNs response codes for uninstall tracking is not reliable and that Apple will use fuzzy schedule to invalidate tokens.
However, showing successful responses for month+ old tokens seems a bit misleading and results in wasted token processing for both us and Apple.
Could you please confirm that invalidation (or fuzzy schedule) could take more than months to invalidate tokens on the APNs side? Is that expected or is this a bug somewhere?
I’m using Appnotic from my server to send notifications for an emergency service, where it is critical that notifications are delivered immediately.
My payload looks like this:
"aps": {
"alert": "Test alert",
"sound": {
"critical": 1,
"name": "sound.wav",
"volume": 0.5
},
"content-available": 1,
"category": "alert"
},
"topic": "com.fireservicerota.FSR-Primary-Alerting",
"custom_payload": {
"id": "11",
"type": "alert",
"incident_id": 23434,
"incident_response_id": 2652343,
"expiration_time": "2024-06-06T16:59:05+01:00"
}
}
I already have the critical alert entitlement and background processing enabled. Everything seems fine when debugging, but I’m experiencing issues:
• Some notifications never arrive
• Around 60% of notifications arrive with noticeable delay
Since this is an emergency app, delivery speed is crucial. What could be causing this inconsistency?
When changing the app's alternate icon using UIApplication.setAlternateIconName(_:completionHandler:), the icon is updated correctly on the Home Screen and App Switcher. However, in Notification Center, the old app icon is still shown for notifications, even after the change has completed. Rebooting or change the device's language causes the correct icon to appear.
This issue only occurs on iOS 18.1 and later. In iOS 18.0 and earlier, Notification Center correctly reflects the updated icon.
Could you provide insights into how iOS caches notification icons and how we can force a refresh for all users?
Version: iOS 18.1 and later (works as expected on iOS 18.0 and earlier)
Area: SpringBoard / Notification Center / App Icon Rendering
Description: When changing the app's alternate icon using UIApplication.setAlternateIconName(_:completionHandler:), the icon is updated correctly on the Home Screen and App Switcher. However, in Notification Center, the old app icon is still shown for notifications, even after the change has completed. This issue only occurs on iOS 18.1 and later. In iOS 18.0 and earlier, Notification Center correctly reflects the updated icon.
- Steps to reproduce:
Create an iOS app with alternate app icons configured in the Info.plist.
Use UIApplication.shared.setAlternateIconName("IconName") to change the icon at runtime.
Send a notification.
Pull down Notification Center and observe the icon shown beside the notification.
- Expected Behavior:
Notification Center should reflect the updated (alternate) app icon immediately after the change.
- Actual Behavior:
Notification Center continues to display the old (primary) app icon. The new icon appears correctly on the Home Screen and App Switcher. Restarting the device does cause Notification Center to update and reflect the correct icon, which suggests a cache or refresh issue in SpringBoard or Notification Center.
- Notes:
Issue introduced in iOS 18.1; not present in 18.0.
Reproduces on both physical devices and simulators.
Occurs with both scheduled local notifications and remote notifications.
Restarting the device updates the Notification Center icon, but this is not a viable user-facing workaround.
Topic:
App & System Services
SubTopic:
Notifications
Tags:
Swift
APNS
User Notifications
Notification Center
I’m building a companion app that connects to a custom hardware hub (IoT device) used for home safety monitoring. The hub is installed in homes and is responsible for triggering critical alerts like fire alarms, motion detection, door sensor activity, and baby monitor events.
Current Architecture:
The hub initially connects to the app via Bluetooth (BLE) for provisioning (to get Wi-Fi credentials).
Once provisioned, the hub switches to Wi-Fi and communicates with the app via a WebSocket connection to stream real-time event updates.
What I’m Trying to Achieve:
My goal is to maintain background communication with the hub even when the app is not actively in use, in order to:
Receive real-time updates from the hub while the device is locked or the app is in background.
Trigger local notifications immediately when critical sensor events (e.g., fire, motion) occur.
Ensure persistence across backgrounding, app swipes (force close), and device reboots, if possible.
What I'm Observing:
On iOS, WebSocket connection is suspended or dropped shortly after the app goes to the background or is locked.
Even though the I've scheduled periodic fetches, notifications are delayed until the app is reopened, at which point all missed WebSocket messages arrive at once.
If the app is force-closed or after reboot, no reconnection or notification happens at all.
Key Questions I Have:
Since the hub is initially provisioned via BLE, and could potentially send BLE flags or triggers for key events, can I use bluetooth-central mode to keep the app active or wake it up on BLE activity?
Once the hub switches to Wi-Fi and uses WebSocket, is it possible to combine BLE triggers to wake the app and then reconnect to the WebSocket to fetch the full event payload?
Is there a legitimate and App Store-compliant way to maintain a connection or background task with:
BLE accessory triggers followed by
Real-time data processing via Wi-Fi/WebSocket?
Would this use case qualify as a "companion device" scenario under iOS background execution policies?
What is the best practice for handling this kind of hybrid BLE + WebSocket alerting flow to ensure timely user notifications, even in background/locked/force-closed states?
Any advice, documentation links, implementation patterns, or examples from similar companion device apps would be greatly appreciated. Thanks in advance!
Topic:
App & System Services
SubTopic:
Core OS
Tags:
User Notifications
Background Tasks
Core Bluetooth
I want to implement a feature where a custom notification sound file is downloaded from the server when the app is first launched and stored locally on the device. When a push notification arrives, the stored sound should be played in all app states, including foreground, background, and terminated (killed) state.
Does anyone have an idea on how to implement this in iOS? Specifically, I am looking for guidance on:
1)Downloading and storing the sound file securely on the device.
2)Using the locally stored file for push notification sounds.
3)Ensuring the sound plays correctly in all states, including when the app is not running.
Topic:
Community
SubTopic:
Apple Developers
Tags:
APNS
User Notifications
Sound and Haptics
Notification Center
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.
Hi,
I’m looking for guidance on enabling push notifications for new emails in the native iOS Mail app (com.apple.mobilemail).
Currently, I send push notifications using macOS Server (formerly OS X Server) Mail, but since it has been discontinued and renewal is no longer possible, I want to transition to the standard method used by email providers to notify the stock Mail app about new messages.
To achieve this, I need access to the com.apple.mobilemail.push.com.zuplu APNs topic. This follows the same pattern used by other providers:
iCloud: com.apple.mobilemail.push.com.me.mail.castle
Fastmail: com.apple.mobilemail.push.com.fastmail
Since Fastmail (as a third-party provider) has access to this, I assume there is a way for independent mail providers to integrate with XAPPLEPUSHSERVICE.
In the interest of a free market and fair competition, I trust that Apple provides a means for email providers to notify the stock Mail app of IMAP server changes, allowing it to fetch new messages instantly.
Under EU competition law, particularly Article 102 TFEU, dominant companies must not engage in anti-competitive behavior, including restricting access to essential services in a discriminatory manner. Furthermore, the Digital Markets Act (DMA) explicitly prohibits gatekeepers from favoring their own services or restricting interoperability without justification.
Any insights or official guidance would be greatly appreciated!
Thanks,
DragonWork
Dear Apple support team,
I have some questions for you about this topic: I'm designing an app that need to send a notification like a classic clock alarm timer to the user, let's say each and every 25 minutes of cellphone usage, ofc only if the device is being used. The thing is that when my app is put to background, then Apple will shut it down after 30-60secs.
I was thinking to send a silent push notification to my app just so I can wake it up for an instant just so it can shoot a local notification, and then keep in the background totally inactive. That means I'll have to send to my app around 3 silent push notifications x hour. Do you think it is a problem for you? or it's ok to do that? Let me know your experience on this matters,
Thanks a lot for your time, A.
Good morning fellow developers,
For a while i am struggeling with providing sound to my users on IOS (Safari on Mac is no problem and every other device is not a problem) (we have an existing phone system and made a chat as well), the case is very simple: the notification sound is only for users who are logged in and online for chat.
i have tried multiple things:
Audio play with javascript (start with mute, play when user clicks a button so the sound is familiar, play when user clicks a button and directly pause it and continue when needed)
PWA: the dashboard has been made available as pwa and notifications using google firebase. The popup does show for notifcations to be allowed (and receiving the notifications does work on any other device) But any IOS device cannot register.
The information i find is that notifications were supported with 16.4 or higher but also have been deprecated around IOS 17, auto play is not allowed.
We have an app in development for our product as well were we will have a notification which will handle this, but that is not the solution we can use now.
Long story, short question: is it still somehow possible to push a notification to the user when using the PWA or play a sound in the browser (based on an ajax function). The app/website wont be in the background, so it will always be on the screen.
Languages we use: html/javascript (mostly vanilla)/php
Hello, I'm from Microsoft team maintaining push notification api behind Teams platform.
We are experiencing strange and short error spikes towards APNS that seem to mostly correlate worldwide. We checked the networking and push request code but could not find what could be causing this. These error spikes are all timeouts or connection resets (by remote host, ie. APNS servers) and seem to come and go randomly:
Would it be possible to check this for outages or some other metrics on your side or investigate why would it happen? Since it's worldwide it seems unlikely it's something broken on our side. We are using the standard APNS http2 endpoint with modern support for all RFC features (so everything should work normally).
Mind you, our api might be in a unique position because of the volume of notifications (in the billions per day).
I'm strugling about the way how to code notifications for my weather aplication. I use data from my server that receives weather changing values from my own weather station and want to notify user of my app when eg strong wind will blow or temperature go under eg 3℃ etc.
The weather station has 8 sensors so there is sometimes a lot of data changing in particular minute that i set to parse data from server and notify user about it. But the notifications only works only when app is on and couple minutes after locking display.
So please what could i use strategy for the app to works even when the app sleeps ?
Topic:
App & System Services
SubTopic:
Notifications
Tags:
APNS
Notification Center
User Notifications
I am trying to retrieve delivered notifications using UNUserNotificationCenter.getDeliveredNotifications(completionHandler:), but I have encountered an issue:
Notifications triggered by UNTimeIntervalNotificationTrigger or UNCalendarNotificationTrigger appear in the delivered list.
However, notifications triggered by UNLocationNotificationTrigger do not appear in the list.
Here is the code I use to fetch delivered notifications:
UNUserNotificationCenter.current().getDeliveredNotifications { notifications in
for notification in notifications {
print("Received notification: \(notification.request.identifier)")
}
}
The notification is scheduled as follows:
let center = UNUserNotificationCenter.current()
let content = UNMutableNotificationContent()
content.title = "Test Notification"
content.body = "This is a location-based notification."
content.sound = .default
let coordinate = CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194) // Example coordinates
let region = CLCircularRegion(center: coordinate, radius: 100, identifier: "TestRegion")
region.notifyOnEntry = true
region.notifyOnExit = false
let trigger = UNLocationNotificationTrigger(region: region, repeats: false)
let request = UNNotificationRequest(identifier: "LocationTest", content: content, trigger: trigger)
center.add(request) { error in
if let error = error {
print("Error adding notification: \(error.localizedDescription)")
}
}
Why does getDeliveredNotifications not return notifications that were triggered using UNLocationNotificationTrigger?
How can I retrieve such notifications after they have been delivered?
when I implementation the UNUserNotificationCenterDelegate
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
var status = ""
if (UIApplication.shared.applicationState == .active) {
status = "active"
} else if (UIApplication.shared.applicationState == .background) {
status = "background"
} else if (UIApplication.shared.applicationState == .inactive) {
status = "inactive"
}
completionHandler()
}
I find that UIApplication.shared.applicationState == .background this case can not execute when application is in background。
why applicationState is inactive not background?
Hi, I am developing the Click & Read web add-on for Chromium, Firefox and Safari. We use xcrun safari-web-extension-converter tool to generate the Safari add-on, with up-to-date MacBook MacOS, Xcode et Safari : Sequoia 15.3.2, Safari Version 18.3.1 (20620.2.4.11.6), XCode Version 16.0 (16A242d).
We have updated our addon to Manifest v3, having the Background script as Server Worker
"background": {
"service_worker": "background.js",
"type": "module"
}
self.addEventListener("activate", (event) => {
console.info("Service Worker activated", event);
event.waitUntil(
self.registration.pushManager
.subscribe({
userVisibleOnly: true,
applicationServerKey: urlBase64ToUint8Array(
process.env.VAPID_PUBLIC_KEY
),
})
.then(async (subscription) => {
console.info("[Service Worker] Extension is subscribed to push");
const { subscription: savedSubscription } =
await getLocalStorageKeyData("subscription");
if (savedSubscription)
fetchApi({
url: `${API_SERVER_URL}/subscription/remove/${savedSubscription.keys.auth}`,
}); // Remove previous subscription from server on addon activate
currentBrowser.storage.local.set({
subscription: subscription.toJSON(),
}); // Save subscription in local storage
currentBrowser.runtime.setUninstallURL(
`${API_SERVER_URL}/subscription/remove/${
subscription.toJSON().keys.auth
}`
); // Set uninstall URL to remove notification subscription on addon uninstall
fetchApi({
url: `${API_SERVER_URL}/subscription`,
reqInit: {
body: JSON.stringify(subscription.toJSON()),
method: "POST",
headers: {
"Content-Type": "application/json",
},
},
});
})
.catch((error) => {
console.error("Push subscribe error: ", error);
}) // Subscribe to push notifications
);
});
When trying to subscribe the addon instance to our Push server, we get this error : Push subscribe error: NotAllowedError: User denied push permission
Our NodeJS backend is using the web-push librabry : https://github.com/web-push-libs/web-push) to save subscriptions and make notifications push.
By looking for same errors on forums, the best hint I found is that it could be related to the testing is done on localhost (addon is built from XCode onto Safari, and Push server is running on localhost).
Thanks for your help !