I'm experiencing issues with didRegisterForRemoteNotificationsWithDeviceToken not being called on iOS 18.1.1. Here's what I've tried:
Basic Setup:
Properly configured UNUserNotificationCenter
Requested permissions with requestAuthorization(options:)
Registered for remote notifications with registerForRemoteNotifications()
Environment:
Xcode 16.3
iOS 18.1.1 (physical device)
Firebase (tried with and without it)
Troubleshooting:
Verified provisioning profile includes Push Notifications
Confirmed APNs certificate is valid
Disabled Firebase's method swizzling
Tested on a clean project (works fine)
Checked device logs (no relevant errors)
Code Snippet:
// In AppDelegate.swift
public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }
let tokenString = tokenParts.joined()
print("📱 Device Token: \(tokenString)")
// Store the token for your backend
UserDefaults.standard.set(tokenString, forKey: "deviceToken")
// Send to backend
Task {
do {
try await APIService.shared.setDeviceToken(tokenString)
} catch {
print("❌ [AppDelegate] Failed to send device token to backend: \(error)")
}
}
}
public func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
// IMPORTANT: First handle push notification registration
UNUserNotificationCenter.current().delegate = self
// Request notification permissions
self.requestNotificationPermissions()
// Register for remote notifications
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
return true
}
private func requestNotificationPermissions() {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, error in
guard granted else {
print("❌ Notification permission not granted")
return
}
print("✅ Notification permission granted")
}
}
How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here
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
Hi,
there is a issue that iOS background NFC scanning will only provide a notification result, It need user click to enter my APP, can I have any method to enter my APP directly without user action ?
Hello, we have recently started signing and building our applications using Xcode 16.3. Since we made this change, we’ve noticed that the applications have stopped receiving silent push notifications (content-available: 1) when they are distributed via TestFlight or the App Store, even though we haven’t changed anything in the way these notifications are sent.
As I mentioned, this started happening after migrating our project from Xcode 15 to Xcode 16.3. Regular push notifications are still working as expected, but silent ones are not being received by the apps.
We are desperate because we rely on these silent notifications to inform the apps of updates, and we haven’t been able to identify the root cause of the issue.
sending the following POST request:
---- HTTP REQUEST ----
POST https://appleid.apple.com/auth/token
Headers:
Content-Type: application/x-www-form-urlencoded
Body:
client_id=au.com.thejlrguy.businesschat&client_secret=eyJhbGciOiJFUzI1NiIsImtpZCI6IktLUDc4MkhGVTcifQ.eyJ...QeDn7ug&grant_type=client_credentials&scope=https%3A%2F%2Fappleid.apple.com
Getting the below error:
{"error":"invalid_client"}
The private key used to sign the JWT was created 24 hours ago.
Is there a public method to know when an APNS has appeared on the screen?
wrapping up a very high end photogrammetry app, using the front facing camera and screen illumination-
incoming notifications completely throw off the math.
Ideally, it would be great to turn on Do Not Disturb for the short process, but we’d settle for just the detection of the notification banner.
also: extra credit - programattically adjusting Auto Dimming, and True Tone would be lovely too.
I wanted to know if Apple ever supported displaying a red dot on notificationswith no indication number.
Topic:
App & System Services
SubTopic:
Notifications
Hey there,i start a live activity,but it not works, and sometime it can work;
apns-unique-id 46445cfa-1bf6-0f63-5ea3-2afa53e02b0d
and it show that "
2025年5月19日 GMT+8 15:13:25.836
received by APNS Server
2025年5月19日 GMT+8 15:13:26.244
discarded as application was not registered"
but i did not know how can i do;
thanks for you help
i hava a app using Gateway.push.apple.com to push Notifications,but it is not working sine last month, i test the api show push Notifications success but my device can't receive the Notifications ,is this api not working anymore ? but why the api show push Notifications success ?
I am creating an app that uses critical messages, I have been granted this entitlement and I am adding the certificate and in the info.plist. In the app I request authorization to send messages to specific numbers. When I try the app in production from Xcode this works fine and I can send the critical messages. However, when I am using the app in the test flight the authorization does not seem to be remembered on the background. Moreover, I go to security/privacy settings and I grant permission to the selected number (I see that it only shows one number even when I have to granted, its like it removes the previous one) however when I exit the setting page the permission is reset (and therefore denied), I think this is a bug. Can you look into that. Both this removing granted permission (HIGH PRIORITY, this message can only be sent in the background, therefore the user can not grant it and why the maximum telephone number to be granted to send messages is reset also to a single one LOWER PRIORITY).
Thanks
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 have implemented Carplay in our voip based project and in this we have implemented Incoming call and chat notification feature for Carplay.
For Carplay we implemented siri.
Siri Object donated Successfully in Notification service Extension when notification didreceive method called.
Donation Code :-
func donateIncomingMessageIntent(sender: String, senderId: String, message: String, messageId: String, userInfo: [AnyHashable: Any],destination:String) {
// Create proper name components
clearAllinteraction()
var nameComponents = PersonNameComponents()
nameComponents.givenName = sender
//unknown
let senderPerson = INPerson(
personHandle: INPersonHandle(value: senderId, type: .unknown),
nameComponents: nameComponents,
displayName: sender,
image: nil,
contactIdentifier: senderId,
customIdentifier: "sender_\(senderId)"
)
let recipientPerson = INPerson(
personHandle: INPersonHandle(value: "me@example.com", type: .emailAddress),
nameComponents: nil,
displayName: "Me",
image: nil,
contactIdentifier: "me_id",
customIdentifier: "user_id"
)
let inMessage = INMessage(
identifier: messageId,
conversationIdentifier: "conversation_\(senderId)",
content: message,
dateSent: Date(),
sender: senderPerson,
recipients: [recipientPerson],
groupName: nil,
messageType: .text
)
let intent = INSearchForMessagesIntent(
recipients: [recipientPerson],
senders: [senderPerson],
searchTerms: [message],
attributes: .unread,
dateTime: nil,
identifiers: [messageId],
notificationIdentifiers: [messageId],
groupNames: ["Messages"]
)
let interaction = INInteraction(intent: intent, response: nil)
interaction.identifier = "message_\(messageId)"
interaction.direction = .incoming // Add direction
DispatchQueue.global(qos: .userInitiated).async {
interaction.donate { error in
if let error = error {
print("❌ Failed to donate INSearchForMessagesIntent: \(error.localizedDescription)")
} else {
print("✅ Donated INSearchForMessagesIntent successfully!")
let intentData: [String: Any] = [
"senderName": sender,
"senderId": senderId,
"message": message,
"messageId": messageId,
"timestamp": Date().timeIntervalSince1970,
"conversationId": "conversation_\(senderId)", // Add conversationId
"destination":destination
]
let defaults = UserDefaults(suiteName: "group.com.chatapp") // 🔁 Use your App Group ID
defaults?.removeObject(forKey: "lastCarPlayIntentData")
defaults?.set(intentData, forKey: "lastCarPlayIntentData")
defaults?.synchronize()
}
}
}
}
Here SenderID is like 3000@abc,2000@abc etc.
In siri ,When we handle INSearchForMessagesIntent at that time all data getting from Userdefaults because without Userdefaults INSearchForMessagesIntent value nil.
Even we enabled announcement using .allowAnnouncement.
We also tried to save same sender in contact Book because sometime siri search contact and not found then may be raise this type of issue.
So we need code level support for read incoming message in carplay when notification comes.
Thank you.
We are developing an app that receives push notifications (via Firebase) from configured IoT devices. It is essential that when a specific type of notification is received, a sound is played continuously until the user interacts with the notification.
This behavior is crucial for alerting users to certain critical states of the IoT device.
We understand that Critical Alerts on iOS can bypass Do Not Disturb and silent mode. However, from our testing and available documentation, the sound from a Critical Alert seems to be limited to around 30 seconds.
Our question:
Is it possible on iOS to have a Critical Alert (or any other type of notification) continue playing sound until the user interacts with the notification or app? If so, could someone please point us to the appropriate documentation or APIs?
Thanks in advance for any guidance.
User is using my app, the goes to System Settings, and changes some of my App's settings (switches, text fields, etc).
Does the system send my app any kind of notification?
David
PS: I tried all kinds of searches on this and found nothing.
Topic:
App & System Services
SubTopic:
Notifications
Hello,
we have a problem with fake call on iPhone device for incoming calls.
When I leave the iPhone in idle state for 30, 40 seconds and dialed voip app number the iPhone rings and there is no problem.
When I leave it in idle for longer time one minute or two minutes I get "Call Failed to Connect" on iPhone's display and after this fake call I get second call with real calling number displays on iPhone.
This first fake call is triggered by wake up push notification type 'voip'.
If I switched off this wake up push notification type 'voip' and device's token has not expired yet I don't get fake call and iPhone's directly displays calling number.
But in this situation we need to use wake up push notification type 'voip' on during a certain time to keep the device's token in our database and continuing to receive calling number without fake call.
If we switched off the wake up push notification type 'voip' on certain time we need to activate again wake up push notification type 'voip' for incoming calls to wake up the iPhone.
And in this way every time on every incoming call the iPhone's will display first fake call "Call Failed to connect" and after that the call with Calling number.
How we can eliminate this fake call and use only one wake up push notification only for incoming calls not use second type wake up push on certain time?
Thank you,
I paste here our code for this:
public ApnClient(IOptions settings)
{
var httpHandler = new HttpClientHandler()
{
ClientCertificates = { new X509Certificate2(certificate.Export(X509ContentType.Pfx)) },
};
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13;
this.httpClient = new HttpClient(httpHandler)
{
DefaultRequestVersion = HttpVersion.Version20,
DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrHigher,
BaseAddress = new Uri(settings.Value.ApnProdBaseUri),
DefaultRequestHeaders =
{
{
"apns-topic", ApnsTopic
},
},
};
}
public async Task<bool> WakeUpDevice(string deviceToken, string callId)
{
this.requestContent = new StringContent(
$"{{\"aps\":{{\"content-available\":\"1\"}}}}",
System.Text.Encoding.UTF8,
"application/json");
var res = await this.httpClient.PostAsync($"/3/device/{deviceToken}", this.requestContent);
return res.IsSuccessStatusCode;
}
Hello Team,
We are working on a requirement where the business wants to track the delivery of push notifications on iOS devices. Specifically, they want to capture the moment when the device receives the notification and it appears as a badge in the Notification Center—regardless of whether the app is in the background or not—and then send that delivery status back to APNs.
We have explored multiple approaches, but so far, we are only able to capture events when the user interacts with the notification banner.
We would like to understand:
Is it technically possible to send an event to APNs or another service upon receipt of the notification on the device without requiring user interaction?
Any guidance or recommendations would be greatly appreciated.
Facing issue while sending push notification through the application. The APNs certificate is valid.
Below is the error log.
System.AggregateException: One or more errors occurred. ---> PushSharp.Apple.ApnsNotificationException: Apns notification error: 'ConnectionError' ---> System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.EndSend(IAsyncResult asyncResult)
at System.Net.Sockets.NetworkStream.EndWrite(IAsyncResult asyncResult)
--- End of inner exception stack trace ---
at System.Net.Security._SslStream.EndWrite(IAsyncResult asyncResult)
at System.Net.Security.SslStream.EndWrite(IAsyncResult asyncResult)
at System.IO.Stream.<>c.b__53_1(Stream stream, IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory1.FromAsyncTrimPromise1.Complete(TInstance thisRef, Func3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at PushSharp.Apple.ApnsConnection.<SendBatch>d__21.MoveNext() --- End of inner exception stack trace --- at PushSharp.Apple.ApnsServiceConnection.<Send>d__2.MoveNext() --- End of inner exception stack trace --- ---> (Inner Exception #0) PushSharp.Apple.ApnsNotificationException: Apns notification error: 'ConnectionError' ---> System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.EndSend(IAsyncResult asyncResult) at System.Net.Sockets.NetworkStream.EndWrite(IAsyncResult asyncResult) --- End of inner exception stack trace --- at System.Net.Security._SslStream.EndWrite(IAsyncResult asyncResult) at System.Net.Security.SslStream.EndWrite(IAsyncResult asyncResult) at System.IO.Stream.<>c.<BeginEndWriteAsync>b__53_1(Stream stream, IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory1.FromAsyncTrimPromise1.Complete(TInstance thisRef, Func3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at PushSharp.Apple.ApnsConnection.d__21.MoveNext()
--- End of inner exception stack trace ---
at PushSharp.Apple.ApnsServiceConnection.d__2.MoveNext()<---
Topic:
App & System Services
SubTopic:
Notifications
Can I using AudioServicesPlaySystemSound for play sound os system on NotificationService?
Is there anyway that I could use AVAudioSession, AVAudioPlayer or anything similar in Notification Service Extension?
I am trying to implement Audio Playback in the Notification Service Extension to play specific audio file when receiving Notification regardless the app state(foreground, background or killed), but I am not able to activate audio session in Notification Service Extension.
NSError *sessionError = nil;
BOOL success = [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&sessionError];
success = [[AVAudioSession sharedInstance] setActive:YES error:&sessionError];
if (!success) {
NSLog(@"Error activating audio session: %@", sessionError);
}
Below is the error that I got when I am trying to run the code above in Notification Service Extension.
Error Domain=NSOSStatusErrorDomain Code=561015905 "Session activation failed" UserInfo={NSLocalizedDescription=Session activation failed}
We would like to better understand the discrepancy between a Push To Start and the subsequent Updates where I see a number of recipients drop greatly.
Our assumption is that this is a result of the end user not clicking the "Allow" prompt when a push to start widget is shown on the screen for the first time, but we currently do not have a way to listen to the user's choice when prompted.
Is there any way of tapping into this, to determine if this is in fact where the variance is coming from, or if there is actually just a problem with the request to retrieve the update token from our end?
I'm observing that when a silent push notification is sent to our app, is is started up in the background for 30 seconds before being suspended until the app is launched by the user. This causes data to persist from the silent push notification to the user app launch.
I couldn't find documentation on this behavior for silent push notifications, and was wondering if it's possible to have the app terminate after handling the silent push notification. Is there documentation on the general flow of silent push notifications as well?
I'm able to handle the edge cases if the app has to be suspended until user launch, but just want to confirm that this is the expected behavior before I go about handling it this way.