When I use https://api.push.apple.com/3/device/e0ae826f3905b010e37c4a07e873481b8446c9dc2788511b2995992884468068
Return error message: {"reason":"BadDeviceToken"}
When I use https://api.development.push.apple.com/3/device/e0ae826f3905b010e37c4a07e873481b8446c9dc2788511b2995992884468068
Return error message:{"reason":"TopicDisallowed"}
why?
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
self.pushRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
self.pushRegistry.delegate = self;
self.pushRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];
//处理接收到的VoIP推送
(void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void(^)(void))completion
then we send message from our server or from apple's cloud service: https://icloud.developer.apple.com/dashboard/notifications website services:
when app is in foreground,withCompletionHandler wil be called correctly,but when app is in background or has killed ,withCompletionHandler not be called!!!
the background fetch、voice over ip is checked in signing & capabilities tabs
why?why?why?why?why?why?why?why?why?
In the main app, is there a way to distinguish whether the application:didFinishLaunchingWithOptions: method is triggered by the user manually clicking the app icon, or whether it is automatically triggered by the system after Live Activities receives a remote message notification?
I want to update my lockscreen LiveActivity via Broadcast Push Notification, but updating always fails - but ending always works.
Payload with "update" is completely ignored:
{"aps":{"timestamp":1685952000,"event":"update","content-state":{"currentSlotName":"Debug1","nextSlotName":"Debug2"}}}
Same payload with "end" works, the view is refreshed with the new content-state:
{"aps":{"timestamp":1685952000,"event":"end","content-state":{"currentSlotName":"Debug1","nextSlotName":"Debug2"}}}
Via the MacOS Console I am able to see that both events happen to end up on the device. I am sending these Broadcast Push Notifications via Apple's Push Notifications Console.
The app will be wake up from killed status by silent notification or not?
This is a question for years, from my test. It will wake up.
Here the wake up means it will call the "didFinishLaunchingWithOptions" method. But we can not see the app in the "recent apps" list after switching home-screen up.
So any Apple dev can give me a detailed explain for this?
The system calendar when showing a calendar event shows a relative timestamp on the notification versus all other apps which have a timestamp of when the notification was sent.
Is there a way to set the timestamp to be relative? I am currently working on a calendar app and we should be able to use the same system that apple uses for its own calendar.
Post about this on stack overflow from someone else a few years ago
Hello, i'm facing issues, when trying to integrate push notification feature into my app. the following message is shown and I don't know how to fix it:
ExportArchive "Runner.app" requires a provisioning profile with the push notifications feature
(Encountered error while creating the IPA)
Thankful for any help! Best regards
Topic:
App & System Services
SubTopic:
Notifications
I have tried setting a 'apns-expiration' to current time + 30 seconds and also a value '0'. But still my voip app receives the voip push notification after 2-3 minutes. Till this time, caller has already hung up the call. But the receivers phone still rings on receiving the push notification as we have to report it to CallKit.
Am I missing something or there is no way and even 'apns-expiration' does not guarantee timely delivery of Voip push notifications or discard if it is expired.
I have set 'apns-priority' to 10 already as recommended.
I'm trying to rewrite a Swift code to Swift 6 language mode and am stuck with this problem. How do I safely pass the bestAttemptContent and contentHandler to the Task? This is from the UNNotificationServiceExtension subclass.
final class NotificationService: UNNotificationServiceExtension {
var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?
var customNotificationTask: Task<Void, Error>?
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
guard let bestAttemptContent = bestAttemptContent else {
invokeContentHandler(with: request.content)
return
}
do {
let notificationModel = try PushNotificationUserInfo(data: request.content.userInfo)
guard let templatedImageUrl = notificationModel.templatedImageUrlString,
let imageUrl = imageUrl(from: templatedImageUrl) else {
invokeContentHandler(with: bestAttemptContent)
return
}
setupCustomNotificationTask(
imageUrl: imageUrl,
bestAttemptContent: bestAttemptContent,
contentHandler: contentHandler
)
} catch {
invokeContentHandler(with: bestAttemptContent)
}
}
// More code
private func downloadImageTask(
imageUrl: URL,
bestAttemptContent: UNMutableNotificationContent,
contentHandler: @escaping (UNNotificationContent) -> Void
) {
self.customNotificationTask = Task {
let (location, _) = try await URLSession.shared.download(from: imageUrl)
let desiredLocation = URL(fileURLWithPath: "\(location.path)\(imageUrl.lastPathComponent)")
try FileManager.default.moveItem(at: location, to: desiredLocation)
let attachment = try UNNotificationAttachment(identifier: imageUrl.absoluteString, url: desiredLocation, options: nil)
bestAttemptContent.attachments = [attachment]
contentHandler(bestAttemptContent)
}
}
}
I tried using the MainActor.run {}, but it just moved the error to that run function.
The UNNotificationRequest is not sendable, and I don't think I can make it so.
Wrap the setupCustomNotification in a Task will move the errors to the didReceive method.
It seems like the consuming keyword will help here, but it leads to a compilation error, even with the latest Xcode (16.2).
Any pointers?
From iPhone iOS 18.3 , 18.3.1, and 18.4 Dev2, VIP Mail alerts will not wake a phone display to notify of a new mail received for a VIP contact. The phone will sound an audible tone indicating the mail was received, and if you manually wake the screen by tapping and then dragging upward to show notifications you will then see the VIP mail alert. However if the screen is sleeping, it will not light up or wake to indicate or display the new mail.
The problem was briefly resolved in 18.4 Dev1, but problem returns in Dev2. We see this across all iPhone 16 Pros and iPhone SE2 with iOS 18.3 or higher. Is this something acknowledged by Apple as on track for resolution in iOS 18.4 Final Release? Thank you.
Topic:
App & System Services
SubTopic:
Notifications
I am developing a VoIP service.
Usually, when receiving a VoIP Push, Callkit is exposed immediately after receiving the message and the app is designed to be used.
However, there is an extremely intermittent phenomenon (not well reproduced) where the app does not wake up even when receiving a VoIP Push. And after a long time, the app wakes up and Callkit is activated. (A long time after receiving the call…)
Has anyone experienced the above phenomenon? I wonder if there are any reported parts depending on the OS version. (I have identified that it does not occur in the 17.x version, but it is difficult to guarantee because it occurs extremely intermittently)
The app is not running in the background, but... Could this be happening if there are a lot of pending operations in the background?
I need help urgently
SIM toolkit DISPLAY message is not displayed.
Use case:
SIP MESSAGE SMS Deliver (SC to MS) - 200 OK
SIP MESSAGE RP-ERROR (MS->NW):111:Protocol error, unspecified
Concatenated messages (2pcs) are resent over NAS and Deliver reports received from UE.
User is not notified of SIM toolkit message.
Topic:
App & System Services
SubTopic:
Notifications
Recently, I attempted to use LiveCommunicationKit to replace CallKit. The goal was to explore better features or integration.
However, a major problem emerged. When the app is in the background or killed, it shows no notifications. This seriously impairs the app's communication functionality as notifications are vital for users to notice incoming calls.
And it is working well when the app is in the foreground.
When the app is in the background, when the push message received. the app get crashed with the following information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push.'
Also, when I use CallKit instead of LiveCommunicationKit, the app works well in all cases.
The code is here:
LCK wrapper:
class LCKWrapper : NSObject, ConversationManagerDelegate {
var mgr: ConversationManager
var lckDelegate: LCKDelegate
var currentCallId: UUID
@objc init(handler: LCKDelegate, appName: String, appIcon: UIImage) {
self.lckDelegate = handler
var iconData: Data?
iconData = appIcon.pngData();
var cfg: ConversationManager.Configuration
cfg = ConversationManager.Configuration(ringtoneName: "ringtone.m4a",
iconTemplateImageData: iconData,
maximumConversationGroups: 1,
maximumConversationsPerConversationGroup: 1,
includesConversationInRecents: false,
supportsVideo: false,
supportedHandleTypes: Set([Handle.Kind.phoneNumber]))
self.mgr = ConversationManager(configuration: cfg)
self.currentCallId = UUID()
super.init()
self.mgr.delegate = self
}
func reportIncomingCall(_ payload: [AnyHashable : Any], callerName: String) async {
do {
print("Prepare to report new incoming conversation")
self.currentCallId = UUID()
var update = Conversation.Update()
let removeNumber = Handle(type: .generic, value: callerName, displayName: callerName)
update.activeRemoteMembers = Set([removeNumber])
update.localMember = Handle(type: .generic, value: "", displayName: callerName);
update.capabilities = [ .playingTones ];
try await self.mgr.reportNewIncomingConversation(uuid: self.currentCallId, update: update)
print("report new incoming conversation Done")
} catch {
print("unknown error: \(error)")
}
}
}
And the PushKit wrapper:
@available(iOS 17.4, *)
@objc class PushKitWrapper : NSObject, PKPushRegistryDelegate {
var pushKitHandler: PuskKitDelegate
var lckHandler: LCKWrapper
@objc init(handler: PuskKitDelegate, lckWrapper: LCKWrapper) {
self.pushKitHandler = handler
self.lckHandler = lckWrapper
super.init()
let mainQueue = DispatchQueue.main
// Create a push registry object on the main queue
let voipRegistry = PKPushRegistry(queue: mainQueue)
// Set the registry's delegate to self
voipRegistry.delegate = self
// Set the push type to VoIP
voipRegistry.desiredPushTypes = [.voIP]
}
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) async {
if (type != .voIP) {
return;
}
await self.lckHandler.reportIncomingCall(payload.dictionaryPayload, callerName: "Tester")
}
}
I'm facing an issue with Live Activity on the Apple Watch. I followed all the configurations outlined in Apple's official documentation, but during testing, I noticed inconsistent behavior. Some devices can display the Live Activity on the Apple Watch without any issues, while others can only see it on the iPhone, even though they are running the same system version. I've already checked the permissions, and everything is set up correctly, but I still haven't found what might be causing this difference. Has anyone experienced something similar or has any debugging suggestions?
Hello,
When attempting to assign the UNNotificationResponse to a Published property on the main thread inside UNUserNotificationCenterDelegate's method
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async
both Task { @MainActor in } and await MainActor.run are throwing a NSInternalInconsistencyException: 'Call must be made on main thread'.
I thought both of them were essentially doing the same thing, i.e. call their closure on the main thread. So why is this exception thrown? Is my understanding of the MainActor still incorrect, or is this a bug?
Thank you
Note: Task { await MainActor.run { ... } } and DispatchQueue.main.async don't throw any exception.
Hello,
We have a Push-to-Talk (PTT) application that is already well established and widely used. Our app has the proper VoIP entitlement, which we are using to wake up the app and establish a WebSocket connection for real-time communication. We are also using CallKit as a supporting mechanism, but not as the primary interaction upon receiving the VoIP Push, since our use case differs from traditional full-duplex VoIP calls.
While our implementation works correctly in many cases, we have noticed a consistent issue where, after multiple VoIP Push notifications, the system still delivers the push, but prevents the WebSocket from reconnecting.
At this point, all connection attempts return errors such as:
• "Software caused connection abort"
This issue persists until the app is manually relaunched, after which the behavior resets and repeats.
We are aware that VoIP Push was originally designed for full-duplex calls, but since Apple allows its use for other purposes through the entitlement, we would like to understand why this limitation is occurring and how to handle it properly.
Questions:
1. Is iOS enforcing stricter background execution rules after multiple VoIP Push events within a short period?
2. Are there any recommended best practices to ensure reliable WebSocket reconnection in this scenario?
Hi team,
I'm developing a feature that's collecting the device locations for home security app.
We've been following
https://developer.apple.com/documentation/corelocation/creating-a-location-push-service-extension
apns-push-type set to location.
apns-priority set to 5.
during testing, we found that the device's notification extension cannot be triggered after device going into lock screen for 10 mins.
Wonder should we set the priority to 10? Thanks!
I invoked the getNotificationSettingsWithCompletionHandler method of UNUserNotificationCenter on multiple test devices. After dismissing the notification permission request dialog (without explicit denial), the returned UNNotificationSettings object showed inconsistent authorizationStatus values across OS versions:
**iOS 18: Returns UNAuthorizationStatusNotDetermined
iOS 14.2:** Returns UNAuthorizationStatusDenied
Where can I find official Apple documentation explaining this behavioral discrepancy between system versions?
I'm facing an issue delivering VoIP push notifications to user devices. It's pretty random, sometimes notifications are delivered and sometimes not. I've had a call with the user to understand and narrow down the issue, including testing delivery of pushes to their device token via Push Notification Console as described here: https://developer.apple.com/documentation/usernotifications/testing-notifications-using-the-push-notification-console#4181180.
I asked a user to use Wi-Fi first and tried delivering around 10 pushes via console and 2 of them were lost while the rest was delivered.
I asked a user to use cellular and tried delivering also around 10 pushes and most of them were lost and only few of them were delivered.
Production environment was used to deliver pushes hence I cannot see delivery log and so I have no visibility over a reason why push wasn't delivered.
I wanted to file a code-level support ticket to get help however I need to supply a sample xcode project which in this particular case doesn't make any sense as I'm using Apple's Push Notification Console tool and it delivers pushes in some cases while doesn't deliver it in other cases.
I'm pretty familiar with all potential reasons why push might not be shown on device, including app early crashes, not reporting a call to CallKit etc. => although you never know, I'm pretty sure it's not our case.
How can I get support on investigating specific user device token delivery issues like in the case I described above? I have device token and push console records but it's not clear how to get support on that.
Thank you!
Hello,
I’m reaching out to gather information regarding the upcoming changes to APNs certificates that are set to be implemented in the beta at the end of January 2025.
Specifically, I would like to understand the following:
What will be the practical impact of these changes on apes apis ?
What actually needed to be done at trust store for this changes, and how will it affect our current setup?
What steps do we need to take to update the certificates on our servers?
it’s crucial for us to address these changes in advance and keep our customers informed.
Thank you for your help!