My app one sec uses push notifications to guide the user back to the app from a Screen Time Shield (screenshot attached).
On iOS 18.1, notifications are delivered with a delay of 10+ seconds, even though they are classified as time sensitive:
notificationContent.interruptionLevel = .timeSensitive
notificationContent.relevanceScore = 1.0
The notification trigger is nil, which according to the documentation should show the notification banner immediately:
var notificationTrigger: UNTimeIntervalNotificationTrigger? = nil
"The condition that causes the system to deliver the notification. Specify nil to deliver the notification right away."
In the sysdiagnose I have noticed that activity related to Apple Intelligence Priority classification delays the notification by 10 seconds ("UserNotificationsCore.IntelligenceActor"):
[create, [id=43C0-B333, time=2024-09-27 06:03:26, bundle=***.riedel.one-sec], Time elapsed=10.373 sec]: Timeout of 10.0 reached. Cancelling work.
[create, [id=43C0-B333, time=2024-09-27 06:03:26, bundle=***.riedel.one-sec], Time elapsed=10.377 sec]: Calling out to completion with failure(UserNotificationsCore.StepFailure.timedOut(exceeded: 10.0 seconds, summaryStatus: Optional(UserNotificationsServices.NotificationSummaryStatus.inferenceTimedOut), priorityStatus: Optional(UserNotificationsServices.NotificationPriorityStatus.inferenceTimedOut))) from 'scheduleTimeoutToPerform(after:for:)'
[create, [id=43C0-B333, time=2024-09-27 06:03:26, bundle=***.riedel.one-sec], Time elapsed=10.378 sec]: Step: UserNotificationsCore.IntelligenceActor, index: 0 exceeded 10.0 seconds
This seems like a bug to me, time sensitive notifications should be exempted from being analyzed for priority, especially if that comes at the cost of delaying notifications by 10 seconds.
Tracked in Radar: FB15255061
Notifications
RSS for tagLearn about the technical aspects of notification delivery on device, including notification types, priorities, and notification center management.
Post
Replies
Boosts
Views
Activity
To receive silent push notifications in the background, I need to include content-available payload into my APNS push notification, and have application(_:didReceiveRemoteNotification:fetchCompletionHandler:) implemented.
When I send a push notification, my app receives and handles it with the above method.
This works correctly and is straightforward to test when the app is running in foreground or background on my device.
I would like to test if my app is woken up correctly from scratch and does the above work. But how do I do this? How do I get my app into the state where it is started when it receives a silent push notification?
When the user force-kills the app, the notification is not delivered. This is also the case when I as a developer force-kill the app which I am testing. I assume it also applies when I force-stop the app running on my device from within Xcode.
Is there any way for me as a developer to terminate the app, which does not count as “force killing”, and would reliably start the app when it receives the background notification?
I just switched back to Apple Watch from Garmin, and in the time away I got both work and personal vehicles with CarPlay. I've noticed that my AW10 does not get ANY notifications pushed to it while I am using CarPlay, which is annoying because only texts and calls get pushed to my CarPlay screen, so i miss everything else.
Additionally, and this may be a bug issue with iOS18, but I also just noticed that my phone (16) does not light up/make sounds for notifications while using CarPlay - so it doesn't light up, nor do the vehicle speakers make sound with IG/snapchat/etc notifications, and even the screen "lock" sound doesn't audibly go off. I've only had CarPlay for a few months, but I typically keep my phone on Silent anyway, so maybe I'm just noticing this now and its not necessarily a new issue? it does make the sound when i get a text, so logically everything else should make a noise.
I've made sure that my general focus and car focus modes are OFF. Sound is ON. Sound volume setting is all the way up. Have also restarted both phone and watch, and “forgot“ the phone from the vehicle and reconnected
Am I doing something wrong here? is there a solution for either problem? From what I've seen, some people say that the AW not getting notifications at the same time as Carplay is a built-in safety feature, which most people do not want... maybe its the same with the phone not alerting to non-text/call notifications?
I am developing a new App that uses Push Notifications. I completed the development of the App itself and I can send Push Notifications from the CloudKit and receive it on my phone.
My problem is sending the Push Notifications from our service API to Apple. If I use the production address gateway.push.apple.com, I can send messages, but they don't work for my new App because it is in development and not yet released. If I use the sandbox address api.sandbox.push.apple.com, I get the following exception:
System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it. [::ffff:17.188.143.98]:2195
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
--- End of stack trace from previous location ---
at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
at System.Net.Sockets.Socket.Connect(String host, Int32 port)
at System.Net.Sockets.TcpClient.Connect(String hostname, Int32 port)
at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port)
The service API for sending Push Notifications was developed in C# .NET 8.0.
Constants:
private readonly string _hostname = "api.sandbox.push.apple.com";
private readonly int _port = 2195;
The code for sending a message.
public async Task Send(string? subtitle, string? title, string message, string deviceId)
{
var payload =
"{ \"aps\": { " +
"\"alert\": { " +
"\"title\": \"" + title + "\", " +
"\"subtitle\": \"" + subtitle + "\", " +
"\"body\": \"" + message + "\"" +
"} " +
"} " +
"}";
try
{
Debug.WriteLine($"apple api request: {payload}");
using var client = new TcpClient(_hostname, _port);
var sslStream = new SslStream(client.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate));
var certificatesCollection = new X509Certificate2Collection(_certificate);
await sslStream.AuthenticateAsClientAsync(_hostname, certificatesCollection, SslProtocols.Tls12 | SslProtocols.Tls13, true);
var array = DataToBytes(deviceId, payload);
sslStream.Write(array);
sslStream.Flush();
client.Close();
}
catch(Exception exception)
{
Debug.WriteLine(exception);
}
}
The certificate that is used in this code was read beforehand:
var clientCertificate = new X509Certificate2(iOSApp.Certificate, iOSApp.CertificatePassword);
We are using a p12 certificate file with a private password.
Again, it works great for an App in Production but not at all for an App in Development. I made use that I use a new p12 developer certificate for the new App when I tested. I also tested with a p12 production certificate. I get the same error.
Any help is appreciated.
Hello,
I am encountering an intermittent TopicDisallowed error while using APNs and would like to ask for your assistance.
Environment:
Authentication: We are using certificate-based authentication with APNs, where the PEM file is stored on the server to authenticate our requests.
API: We are using the HTTP/2 API and calling the /3/device/<device_token> endpoint while passing the apns-topic in the request header.
Issue:
After renewing our APNs certificate, the new certificate mistakenly included an incorrect app bundle ID, resulting in a TopicDisallowed error.
We then issued a new certificate with the correct bundle ID and replaced it on our server before resuming remote push requests.
However, even after replacing the certificate, we are still intermittently receiving the TopicDisallowed error, while other requests successfully return a 200 OK response and deliver notifications to devices.
Over time, the frequency of TopicDisallowed responses has been decreasing, leading us to speculate that APNs might be caching responses and updating this cache over time.
Questions:
Could you provide details on the specific conditions or causes that lead to a TopicDisallowed error?
After replacing the certificate, is there a reason why we might still be intermittently receiving this error? Are there additional certificate or configuration settings we should check?
What might cause some requests to succeed with a 200 OK response, while others result in a TopicDisallowed error with the same setup?
Is it possible that APNs could be caching outdated information from the previous certificate, which might explain the decreasing frequency of the errors?
We have reviewed our certificate and configuration after the renewal, but the issue persists. Any guidance on how to further troubleshoot or resolve this would be greatly appreciated.
Thank you.
We provide users with an iOS app that sends VoIP notifications.
However, we received issue from users that "VoIP notifications were not sent."
So we conducted an investigation on-site and sent VoIP notifications more than 10 times to about 20 devices.
We confirmed that most of the notifications arrived, but there were also times when the notifications were not sent.
We would like to know if the VoIP notifications were really delivered to the devices that did not receive the notifications.
If this phenomenon is a network problem, we would like to consult with the network company.
We have attached the log of when we checked and the VoIP notification was not received.
logs
[2024-09-12 11:50:02]
'ApnsId' => '22541A6E-355E-73D6-D28F-D1F8E340E540'
'StatusCode' => 200
[2024-09-12 11:50:02]
'ApnsId' => '22541A6E-355E-73D6-D28F-D1F8E340E540'
'StatusCode' => 200
[2024-09-12 11:50:02]
'ApnsId' => '2984C9F3-CC81-9080-7B54-EF53D2E77D68'
'StatusCode' => 200
[2024-09-12 12:43:01]
'ApnsId' => 'A936595B-36F7-07C2-CFB7-3276C4BE8FC8'
'StatusCode' => 200
[2024-09-12 12:43:01]
'ApnsId' => '0C633C08-25B0-6FE2-2087-DD66C1C01532'
'StatusCode' => 200
According to these, the status code is 200.
We would like to know if the VoIP notifications in the logs shown above were received by the iPhone device we tested.
PLATFORM AND VERSION
iOS
Development environment: Xcode 15.4, macOS 14.5
Run-time configuration: iOS 17.5.1
DESCRIPTION OF PROBLEM
We use PushKit to push offline messages of Voip, and use Voip notifications to bind with CallKit to implement Voip call functions.
During the test, we found that when the app is in the background or the screen is locked, Voip messages cannot reach the device stably. After several consecutive calls, the phone will not be able to receive new messages for a period of time. Only after the App is uninstalled and reinstalled can it continue to receive messages.
STEPS TO REPRODUCE
1: Open the app and log in successfully
2: Push the app to the background, kill it or lock the screen
3: Use another user to make a voip call to this device
4: Repeated calls
My Code
private let synthesizer = AVSpeechSynthesizer()
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback)
let utterance = AVSpeechUtterance(string: "Hello Sim")
utterance.voice = AVSpeechSynthesisVoice(language: "th_TH")
utterance.rate = 1.0
utterance.pitchMultiplier = 1.0
utterance.volume = 1.0
utterance.preUtteranceDelay = 0
self.synthesizer.usesApplicationAudioSession = false
self.synthesizer.speak(utterance)
} catch {
print(error.localizedDescription)
}
if let bestAttemptContent = self.bestAttemptContent {
contentHandler(bestAttemptContent)
}
}
Info.plist enable
UIBackgroundModes
audio
fetch
processing
remote-notification
payloadNotification
{
"aps":{
"alert":{
"title":"title"
"subtitle":"subtitle"
"body":"body"
}
"mutable-content":1
"content-available":1
"sound":"tester.caf"
}
}
This code can play in simulator but can't play in real device
I have set up server notification in my app.
I have set up only production server URL and through that URL I can check "CONSUMPTION_REQUEST", "REFUND" notificationType.
However, I want to check all notifications for in-app purchases.
For example, "ONE_TIME_CHARGE" which is consumable in-app purchase type.
If I want to check more notificationTypes on my server,
Do I need to add another setting?
Test notifications are also checked in my server.
https://api.storekit.itunes.apple.com/inApps/v1/notifications/test
Hi Apple Engineers,
Is there an outage of the sandbox API for push notifications?
Since 3:00 AM (CEST) today, I haven’t received any notifications on my test devices.
I have updated my phone to ios 18, after that my CarPlay is not working in Mazda CX-5, I tried with wire also but it did not connect
Yesterday, I upgraded to macOS Sequoia, and this notification keeps popping up. I don't even know what this is about.
If someone knows how to deal with this, please let me know.
Thank You
Hi when setting the language to iOS 6 my app crashes on this piece of code:
func registerForPushNotifications() {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
print("Permission granted: \(granted)")
guard granted else { return }
self.getNotificationSettings()
}
}
It has to do with the requestAuthorization
When I restart the app it crashes immediately. This is because I had already made a choice for this.
When I change the language back to swift 5 it works fine again.
Removing the self.getNotifcationSettings has nothing to do with it.
Also tried to add @MainActor to the function.
This is the tread where it crashes on:
Thread 7 Queue : com.apple.usernotifications.UNUserNotificationServiceConnection.call-out (serial)
Does anybody have a idea how to fix this?
I recently updated my iOS operating system to the latest iOS18. Immediately after updating my CarPlay begin having issues. I began Troubleshooting and came up with some conclusions. If anyone can help that would be amazing.
When NOT connected to carplay via cable, the Bluetooth works perfectly.
When connected via cable to CarPlay the system is does not recognize Bluetooth. The phone begins to play through speakerphone, radio turns on and is playing in background.
please help fix this issue. I can not have carplay not working along with Bluetooth in vehicle.
Hello, we have an app that has a case where the user can turn on a feature that starts a timer for a thing when they arrive at a specific location.
Our app also has a live activity to show the timer.
Naturally, we're trying to make our live activity to start counting when the geofence triggers, but we get ActivityAuthorizationError.visibility. If an activity is already running, it's possible to turn it off.
So, our question is basically if there's any way to make the geofence trigger start our live activity?
Thanks
A few days ago I started receiving errors from my server about it being unable to find the host api.sandbox.push.apple.com. About 10 minutes ago I tried to ping that domain and got an unknown host error. Just now I tried it again and it was able to find the host. Is there some intermittent issue with their DNS?
Hi,
since at least yesterday api.sandbox.push.apple.com is not available.
It was working before, but now it seems the domain can't be resolved.
I tried nslookup in the terminal.
nslookup api.sandbox.push.apple.com
** server can't find api.sandbox.push.apple.com: NXDOMAIN
Lookup of the production server works:
nslookup api.push.apple.com
Non-authoritative answer:
api.push.apple.com canonical name = api-vs.push-apple.com.akadns.net.
Name: api-vs.push-apple.com.akadns.net
Address: 17.188.180.206
Name: api-vs.push-apple.com.akadns.net
Address: 17.188.180.76
Name: api-vs.push-apple.com.akadns.net
Address: 17.188.180.138
Name: api-vs.push-apple.com.akadns.net
Address: 17.188.182.203
Name: api-vs.push-apple.com.akadns.net
Address: 17.188.180.78
Anyone having the same problem?
This error has been continuously occurring for about 9 hours. We have not replaced the certificate, modified the server code, or changed the firewall policy. Some requests succeed, but many are timing out, with several timeouts occurring every minute. We are unable to find the cause. Please help.
APNS Exception io netty channel ConnecttimeException: Connection timed out
APNSOutboundHandler
api.push.apple.com/17.188.169.28:443
api.push.apple.com/(other ip):443
api.push.apple.com/(other ip):443
api.push.apple.com/(other ip):443
api.push.apple.com/(other ip):443
...
Back story: I'm developing an app that communicates with a personal medical device. We use critical alerts when we have hardware issues that could result in harm to the patient. The audio file is a 30 second file to make sure the patient is aware. If the app is open when they occur, we pop up a modal message in the app. When the user dismisses the notice, we call UNNotificationCenter::removeDeliveredNotifications(withIdentifiers:) to remove the critical alert and also to stop the audio file that is playing.
This normally works fine. However we discovered that if the patient leaves critical alert enabled but disables notifications for our app, that we can still post the critical alert and it goes off. However when the user dismisses the message, the removeDeliveredNotifications call does not work. I did some debugging and if call getDeliveredNotifications with this permission combination, it return 0 (normally it would return 1).
Does anyone know of another way to remove the critical alert in this situation? (or should I be submitting this as a bug?)
I can successfully start a Live Activity using push-to-start token, but in order to update the Live Activity i need another token as stated in the docs:
While the system starts the new Live Activity and wakes up your app, you receive the push token you use for updates.
When the app is open, i can retrieve this update token and successfully update the Live Activity using this example code:
func observeActivityPushToken() {
Task {
for await activityData in Activity<LiveActivityAttributes>.activityUpdates {
Task {
for await tokenData in activityData.pushTokenUpdates {
let token = tokenData.map { String(format: "%02x", $0) }.joined()
print("Push token: \(token)")
}
}
}
}
}
But when the app is closed, how/where do i manage to get this update token and send it to the server "when the system wakes up the app"?