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?
APNS
RSS for tagSend push notifications to Mac, iOS, iPadOS, tvOS devices through your app using the Apple Push Notifications service (APNs).
Posts under APNS tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
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
...
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"?
I have been trying to implement APNS Push Notifications into the iOS App I'm currently developing, and I'm having issues with notifications sent via my custom server not being delivered. I have built and ran the App on my device (iPhone running iOS 17.6.1), requested permission for notifications from UNUserNotificationCenter, and saved the device token for testing purposes.
As a sanity check for the device token and the App entitlements, I used the CloudKit tool for testing Push Notifications. The notifications I send aimed at the "DEVELOPMENT" Environment work properly and arrive on the device.
To configure my custom server, I created the Sandbox Apple Push Notifications certificate in my Developer portal, installed it on my Mac, exported the certificate and key together into a .p12 file, and created the PEM file using this command:
openssl pkcs12 -in Certificates.p12 -out sandbox.pem -nodes -clcerts
When my server attempts to send a notification, it appears to connect to the server and send the payload, but the notification never arrives on the device. I don't get any errors when my server writes the notification's binary payload to the connection.
For clarity, here is the code from my server that sends the "aps" payload to APNS (written in PHP):
public function sendPushNotification($deviceToken, $title, $message)
{
$jsonPayload = $this->composePayload($title, $message);
$msg = $this->buildBinaryNotification($jsonPayload, $deviceToken);
$this->connectToApns();
$result = fwrite($this->mApnsConnectionHandle, $msg, strlen($msg));
if (!$result)
{
$this->writeToLog("Message not delivered?!");
} else {
$this->writeToLog("Message successfully delivered!");
}
$this->disconnectFromApns();
}
And this is the code for constructing the JSON payload, and for converting that JSON into a binary string:
private function composePayload($title, $message)
{
// Create the payload body
$body['aps'] = array(
'alert' => array(
'title'=>$title,
'body'=>$message
)
);
// Encode the payload as JSON
$payload = json_encode($body);
return $payload;
}
private function buildBinaryNotification($payload, $deviceToken)
{
if (strlen($payload) > 0 && strlen($deviceToken) > 0)
{
$msg = chr(0) . pack('n', strlen($deviceToken)) . pack('H*', $deviceToken) . chr(0) . pack('n', strlen($payload)) . $payload;
}
return $msg;
}
Any suggestions or advice would be appreciated.
I am using a standard PHP script to send a push notification using a JSON web token (JWT). This works perfectly from the MacOS command line.
But the same setup will not go through to the sandbox from a website on cPanel using PHP 8.3.
The error is: Curl failed: Private key does not match the certificate public key
There are no errors in the error logs.
Any ideas?
Hello,
I have an app which I have enabled VoIP entitlement and implemented all the CallKit and PushKit registries and delegates.
I can successfully get a VoIP token.
I can successfully send VoIP push notifications (and receive them via the PushKit delegate function) and then report an incoming call via CallKit, but only while my app is in the foreground.
I have checked the entitlement in XCode and the Info.plist directly, and they both (as expected) show voip as a background mode.
The VoIP notification is being sent via AWS SNS and everything works while the app is in the foreground. I cannot understand why the app is not waking up while in the background.
This is the VoIP notification sent via SNS:
aps: {
alert: "Intercom call",
"content-available": 1
}
SNS Message Attributes:
'AWS.SNS.MOBILE.APNS.TOPIC': {
DataType: 'String',
StringValue: `${bundleId}`
},
'AWS.SNS.MOBILE.APNS.PUSH_TYPE': {
DataType: 'String',
StringValue: 'voip'
},
'AWS.SNS.MOBILE.APNS_VOIP.TTL': {
DataType: 'String',
StringValue: '0'
},
'AWS.SNS.MOBILE.APNS_VOIP_SANDBOX.TTL': {
DataType: 'String',
StringValue: '0'
},
'AWS.SNS.MOBILE.APNS.PRIORITY': {
DataType: 'String',
StringValue: '10'
}
As I say,
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) async
works correctly when in the foreground. I cannot see any reason why it would not work from the background.
I am also receiving normal remote notifications correctly foreground and background.
An incident occurred in which the same device token was sent from different IDFVs.
To investigate the cause, please let me know the informations below.
・What are the conditions under which the IDFV changes?
・When an IDFV changes due to uninstallation, etc., does the device token always change?
・Is there a chance that a device token that has been used in the past in another terminal will be used in another IDFV terminal?
I would like to add both a Notification Service Extension and a Notification Content Extension to my application.
After reading some documentation and tutorials etc. I'm not clear if the Communication Notifications capability is needed or not.
If it is, should it get added to the App ID or the notification IDs, or both?
Is there a way to export all push notification console information via API or webhook?
in Push Notifications Platform :
when i test the device remove our app , the status result is “- discarded as device was offline”
when i test close the notification auth in our app, the status result is “- stored for device power considerations"
but i saw the flow in doc , I didn't directly saw that these two states are like this https://developer.apple.com/documentation/usernotifications/viewing-the-status-of-push-notifications-using-metrics-and-apns
how can i know the directly status in this two cases ?
I have triggered few notifications, and they were delivered to my iPhone with a delay of several hours. Could you please assist us in resolving this issue?
Device: iPhone 15
OS Version: 17.5.1
I was seeing APNS traffic not honor the networking routing table and instead forced onto a specific interface starting in the beta releases of macOS Sequoia.
I wanted to ask here to see if it was by design. Were there any release notes or communication in regards to this change?
I can imagine it being an intentional fix for some issue that Apple customers ran into, but I can also imagine this could be unintentional or a bug, so I wanted to double check.
Thank you
One of our customer has reported that pushes are delivered with big delay. Pushes are send to APNS in less than 5 seconds as per our statistics but it takes sometimes up to 5 minutes for notifications to arrive on devices.
The authentication used is certificate based even though token based authentications is also tried out before. They have around 346252 subscribed device tokens (users) to which important pushes are send out.
We use HTTP/2 based connections and reuses the connections. To avoid push bursts over selective connection, we distribute push traffic across different APNs servers.
Sample headers:
[:method: POST, :authority: api.push.apple.com, :path: /3/device/, :scheme: https, apns-expiration: 1723721057, apns-priority: 10, apns-topic: , authorization: bearer ]
Sample payload:
{"reference":"{"id":"lux.DvKH5JCtCcus5EaW5Houcn","type":"articleReference"}","aps":{"badge":0,"alert":{"body":"„Warum werden nicht ein paar gesetzliche Feiertage gestrichen?“ Munich-Re-Chef Joachim Wenning fordert, dass die Deutschen mehr arbeiten sollten"},"sound":"default","mutable-content":1},"tracking":"{"piano":{"ivw_category":"thema_wirtschaft","pcat":"paid","date_sent":1723629099370,"main_topic":"unternehmen","push_channel":"11124","section":"wirtschaft","object_id":"lux.DvKH5JCtCcus5EaW5Houcn","push_text":"warum_werden_nicht_ein_paar_gesetzliche_feiertage_gestrichen_munich_re_chef_joachim_wenning_fordert_dass_die_deutschen_mehr_arbeiten_sollten_plus"},"ivw":{"ivw_category":"thema_wirtschaft","ivw_code":"spracheDE/formatTXT/erzeugerRED/homepageNO/auslieferungMOB/appYES/paidNO/inhaltTHEMA/merkmalWIRTSCHAFT/ressortWIRTSCHAFT/portalAPP"},"firebase":{"ivw_category":"thema_wirtschaft","pcat":"paid","date_sent":1723629099370,"main_topic":"unternehmen","push_channel":"11124","section":"wirtschaft","object_id":"lux.DvKH5JCtCcus5EaW5Houcn","push_text":"warum_werden_nicht_ein_paar_gesetzliche_feiertage_gestrichen_munich_re_chef_joachim_wenning_fordert_dass_die_deutschen_mehr_arbeiten_sollten"}}"}
Please let us know what could be the reason and steps we could take to avoid such delivery delays.
About 2 or 3 months ago, when my app receive a Silent Push notification([aps][content-available] = 1), only func "application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler" had triggered.
But now, when my app receive Silent push, my app triggered 3 func :"didFinishLaunchingWithOptions"; "application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo" and "application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler".
Does Apple update this logic? Are there any solution to push silent that just triggered only one func like before?
We have encountered an issue while developing our own Apple MDM solution. The issue occurs in the activation lock scenario.
We have implemented the activation and deactivation of the activation lock feature in accordance with the following documentation.
1:https://developer.apple.com/documentation/devicemanagement/activation_lock_a_device
2:https://developer.apple.com/documentation/devicemanagement/device_assignment/activation_lock_a_device/creating_and_using_bypass_codes#3734453
Activationlock
Request URI : https://mdmenrollment.apple.com/device/activationlock
Request Method : POST
Request Headers : [Accept:"text/plain, application/json, application/*+json, /", X-ADM-Auth-Session:"1723449441118O1O649496FAD285FDC77565EC075E770547O90695212BB76419F8E43B2F68BE7A6C6O67033512O11Op1OA0EA85747E70D2D6941C4F6662166CAF22C2193COC298C61ECC7B9E9C14EB2A20305F7E41", X-Server-Protocol-Version:"3", Content-Type:"application/json", Content-Length:"133"]
Request Body : {"device":"K2LP4HQXJ4","escrow_key":"QRV7D-JPPMQ-Z90N-1VN8-L1PN-45Q2","lost_message":"xxxxx"}
Response : {"serial_number":"K2LP4HQXJ4","response_status":"SUCCESS"}
escrowKeyUnlock
Request URI : https://deviceservices-external.apple.com/deviceservicesworkers/escrowKeyUnlock?serial=K2LP4HQXJ4&imei=357174298879232&meid=35717429887923&productType=iPhone14,2
Request Method : POST
Request Headers : [Accept:"text/plain, application/json, application/*+json, /", Content-Type:"application/x-www-form-urlencoded", Content-Length:"189"]
Request Body : orgName=xxxxx&guid=xxxxx&escrowKey=QRV7D-JPPMQ-Z90N-1VN8-L1PN-45Q2
Response : 404 <ns:escrowKeyDeviceServicesResponse version="1" xmlns:ns="http://www.apple.com/cds/mdmescrowKeyDeviceServices/xml"></ns:escrowKeyDeviceServicesResponse>
Who can help me check if there are any errors in the way I'm calling these two APIs, and how to correct them?
I use then interface https://developer.apple.com/documentation/devicemanagement/device_assignment/activation_lock_a_device/creating_and_using_bypass_codes#3734453
to remove Activation Lock。
request url:https://deviceservices-external.apple.com/deviceservicesworkers/escrowKeyUnlock?serial=***&productType=***&imei=***&meid=***
then body is escrowKey、orgName、guid
and use APNs certificate when establishing the SSL connection
but return me:<ns:escrowKeyDeviceServicesResponse version="1" xmlns:ns="http://www.apple.com/cds/mdmescrowKeyDeviceServices/xml"></ns:escrowKeyDeviceServicesResponse>
I am trying to start a live activity via push token with the below headers and payload. I am using the 'fetch-http2' npm module to execute the APNS request in a deno/typescript environment, and am authenticating via token/p8. The device receives the alert portion of the payload, but the live activity does not appear on the device. I get a 200 OK response from APNS with the unique ID, and dashboard shows notification was successfully sent to the device.
The odd thing, when backgrounding the app dismisses to the Dynamic Island with the animation as if there were a live activity happening, but there is not. When I check Activity<MyAttributes>.activities on app launch, it's empty. I don't see any errors in Xcode when I have the app running/foregrounded when sending the request. Quitting the app restores normal behavior.
TL;DR:
I have regular APNS alert push notification requests working without issue from the same environment. However when attempting to start a live activity via APNS, the alert is received but the live activity does not appear, despite the app/system seemingly thinking there is one. What could I be missing, or what else could I try?
I have checked that:
My generated JWT and device token are valid according to CloudKit dashboard (again, standard push alerts are working as expected)
I can successfully start a live activity locally/from foreground via Activity.request
I have added Supports Live Activities and Supports Live Activities Frequent Updates to my app's info.plist, and also have the required capabilities enabled (remote push, background processing, background fetch)
I am using the current device push-to-start token (obtained from device via Activity.pushToStartTokenUpdates) for the device token in the APNS request (NOT the update token)
My ActivityAttributes and ActivityAttributes.ContentState values and types are correct
"headers": {
"authorization": "bearer {jwt}",
"apns-push-type": "liveactivity",
"apns-topic": "{bundleId}.push-type.liveactivity"
}
"aps": {
"attributes-type": "LiveActivityAttributes",
"attributes": {
"title": "Test Event"
},
"content-state": {
"status": 1
},
"event": "start",
"alert": {
"title": "Alert Title",
"body": "Live Activity has started."
},
"sound": "default",
"timestamp": Math.round(Date.now() / 1000)
}
I have a few devices that don‘t connect MDM server.
It work well after enroll the MDM server, but it won't work anymore after a few days.
MDM server send apns request, apns server always return success, and i try power off / on, restore network, restore all settings, but still don't work.
What could cause this situation,and is there a solution?
I'm trying to develop a Live Activity Extension. The problem is, I can't get pushToStartToken. I'm able to get it when I start a Live Activity, but I can't when I don't start a Live Activity.
This function successfully generates the token:
private func startNewLiveActivity() async {
guard #available(iOS 16.2, *) else { return }
let attributes = MyWidgetAttributes(
homeTeam: "Badger",
awayTeam: "Lion",
date: "12/09/2023"
)
let initialContentState = ActivityContent(
state: MyWidgetAttributes.ContentState(
homeTeamScore: 0,
awayTeamScore: 0,
lastEvent: "Match Start"
),
staleDate: nil
)
guard let activity = try? Activity.request(
attributes: attributes,
content: initialContentState,
pushType: .token
) else { return }
if #available(iOS 17.2, *) {
Task {
for await data in Activity< MyWidgetAttributes>.pushToStartTokenUpdates {
let token = data.map { String(format: "%02x", $0) }.joined()
// THE DESIRED pushToStartToken TOKEN IS GENERATED HERE
}
}
}
for await data in activity.pushTokenUpdates {
let token = data.map { String(format: "%02x", $0) }.joined()
// I send token to server here.
}
}
But when I try to get pushToStartToken separately, without creating a live activity, it doesn't return any value:
private func getPushToStartToken() async {
guard #available(iOS 17.2, *) else { return }
Task {
for await data in Activity<MyWidgetAttributes>.pushToStartTokenUpdates {
let token = data.map { String(format: "%02x", $0) }.joined()
// THIS DOESN'T GENERATE ANY TOKENS SINCE THE ACTIVITY IS NOT CREATED
}
}
}