Post not yet marked as solved
I wanted to integrate location push extension to my app I followed the documentations and applied for the entitlement.
I followed these steps:
I added com.apple.developer.location.push to my app entitlement as follows
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.developer.location.push</key>
<true/>
</dict>
</plist>
I got the location push token and formatted it to string
locationManager.startMonitoringLocationPushes(completion: { data, error in
if let error = error {
print(error)
return
}
guard let data = data else { return }
let token = data.reduce("", {$0 + String(format: "%02X", $1)})
print(token)
})
I exported the APNS push certificate after enabling additional capabilities from the app store connect and keychain. then converted to pem format
openssl x509 -in aps_development.cer -inform der -out PushCert.pem
openssl pkcs12 -nocerts -out PushChatKey.pem -in PushChatKey.p12
Tried to send push using command line
TOPIC="com.myapp.location-query"
CERTIFICATE_FILE_NAME="./test.p12:1234"
CERTIFICATE_KEY_FILE_NAME="./new2k.pem"
APNS_HOST_NAME="api.sandbox.push.apple.com"
DEVICE_TOKEN="FE979AB7DAC975DD19E2F977EDB9BCD13C870AFD97D8D20955039666AA5DXXXX"
curl -v \
-d '{}' \
--header "apns-topic: $TOPIC" \
--header "apns-push-type: location" \
--http2 \
--cert $CERTIFICATE_FILE_NAME \
--cert-type P12 \
--http2 https://$APNS_HOST_NAME/3/device/$DEVICE_TOKEN
and the response is
* Trying 17.188.138.70:443...
* Connected to api.sandbox.push.apple.com (17.188.138.70) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
* CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS handshake, CERT verify (15):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=api.development.push.apple.com; OU=management:idms.group.533599; O=Apple Inc.; ST=California; C=US
* start date: Dec 10 00:29:46 2021 GMT
* expire date: Jan 9 00:29:45 2023 GMT
* subjectAltName: host "api.sandbox.push.apple.com" matched cert's "api.sandbox.push.apple.com"
* issuer: CN=Apple Public Server RSA CA 12 - G1; O=Apple Inc.; ST=California; C=US
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x11c80ce00)
> POST /3/device/FE979AB7DAC975DD19E2F977EDB9BCD13C870AFD97D8D20955039666AA5DXXXX HTTP/2
> Host: api.sandbox.push.apple.com
> user-agent: curl/7.77.0
> accept: */*
> apns-topic: com.myapp.location-query
> apns-push-type: location
> content-length: 2
> content-type: application/x-www-form-urlencoded
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 1000)!
* We are completely uploaded and fine
< HTTP/2 400
< apns-id: CA7EC88D-E839-318B-D9DC-DCB533F50808
<
* Connection #0 to host api.sandbox.push.apple.com left intact
{"reason":"TopicDisallowed"}%
But I always get TopicDisallowed response
Did I miss something?
Post not yet marked as solved
Enterprise internal APP, whether to implement Intranet notification push (The push server is deployed on the Intranet and cannot access APNS)
Post not yet marked as solved
I'm Facing an issue when i Debug Project in Real Device, I'm Getting Notification With Custom Sound, But After making a Build Via Diwai, I'm Not Getting Custom Sound, It Play Default Sound with Notification.I'm Using Firebase. I have Added Custom Sound in Project and added in Bundle Resources as well. Please Have A look on My Code.
Here's My Code
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let content = UNMutableNotificationContent()
content.sound = UNNotificationSound(named:UNNotificationSoundName(rawValue:
"EigenIntro.caf"))
FirebaseApp.configure()
Messaging.messaging().delegate = self
if #available(iOS 10.0, *) {
// For iOS 10 display notification (sent via APNS)
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: { _, _ in
}
)
} else {
let settings: UIUserNotificationSettings =
UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
application.registerUserNotificationSettings(settings)
}
Messaging.messaging().token { token, error in
if let error = error {
print("Error fetching FCM registration token: \(error)")
} else if let token = token {
print("FCM registration token: \(token)")
}
}
application.registerForRemoteNotifications()
return true
}
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
print("Firebase registration token: \(String(describing: fcmToken))")
self.sendDataToServer(token: fcmToken!)
}
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions)
-> Void) {
let userInfo = notification.request.content.userInfo
print(userInfo)
completionHandler([[.alert, .sound, .badge]])
}
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
print(userInfo)
completionHandler()
}
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let token = deviceToken.hexString
print("APNs Device Token: \(token)")
Messaging.messaging().apnsToken = deviceToken
Messaging.messaging().setAPNSToken(deviceToken, type: .prod)
}
func application(_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
Messaging.messaging().appDidReceiveMessage(userInfo)
completionHandler(.noData)
}
Post not yet marked as solved
Hi Team,
We are trying to connect with our .pem file to apple, for testing pushnotification and here our UseCase
Send - Connection
Send -> Block
a few minutes later
Send -> Connection
Send -> Block
where
Block = connection refused, so it failed to even "connect" to apple
We also notice that the DNS resolved to many different IP addresses. Some work, some block
some IP addresses send us reset packets which means we get connection refused and some complete the TCP handshake and work.
When is the old SSL push notification supported up to before we have to swap to HTTP2?
we are trying to work out IF this is still supported?
any help would be appreciated
Thanks in advance.
Post not yet marked as solved
When a message is pushed to APNs, if the APNs domain name is resolved to one of the IP addresses, the BadPath is returned. When the APNs domain name is resolved to another IP address, the message is pushed normally. return BadPath ip list sample: 17.188.137.22:443 17.188.134.20:443 17.188.129.26:443 17.188.181.77:443 17.188.140.149:443 17.188.172.32:443 17.188.172.91:443 17.188.181.78:443 17.188.181.206:443 17.188.181.76:443 17.188.132.153:443 17.188.172.33:443
Post not yet marked as solved
I’m planning on making on making a prototype of a phone case that brings back the android LED light that shines a specific color depending on notifications received by the user so you can just glance at phone. I’m wondering if there is a way to see what apps have sent notifications to the user?
On a side note, would it be possible to see what apps a user has to allow LED customization? Specific apps = specific lights system.
Post not yet marked as solved
We have tried all the suggestions on iPhone settings for iOS 15 and double checked code base as well as APNS payload. We have not sound on push notifications and don't understand what has changed. Our code base worked on previous iOS version on previous Apps. Is there a new way of getting sound in push?
Post not yet marked as solved
It looks like APS Environment is configured by setting the aps-environment value in an app entitlements file to either development or production. However, it seems to be the case that, by default, Xcode automatically overrides the set value when an app is signed and the value is instead derived from the provisioning profile.
So, for development profiles, you get development (sandbox) aps-environment, and for distribution profiles, you get production aps-environment configured - regardless of how the setting has been configured in the entitlements plist.
This is documented here: https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment
That document also states that this default behaviour can be overridden: "These default settings can be modified".
Question is, how to override these default settings. In other words, how to point aps-environment to production, even if provisioning profile is development.
Any insight appreciated, thx.
Post not yet marked as solved
For my iOS app - when I set same thread-id for grouping and apns-collapse-id same for multiple notification, it works (notifications get collapsed). When I try same apns-collapse-id with different thread-id collapsing doesn't work. How are both related. I have debugged to make sure the values are correct
Post not yet marked as solved
We are using communication notification to update notification icon, but for us it's not working for xamarin project.
var handle = new INPersonHandle("unique-user-id-1", INPersonHandleType.Unknown);
var avatar = INImage.FromName("abc.png");
var sender = new INPerson(handle, null, "Example", avatar, null, null);
var intent = new INSendMessageIntent(null,INOutgoingMessageType.Text,
"Message content",
null,
"unique-conversation-id-1",
null,
sender,null);
// Use the intent to initialize the interaction.
var interaction = new INInteraction(intent: intent, response: null);
interaction.Direction = INInteractionDirection.Incoming;
interaction.DonateInteraction((error) =>
{
// ...
});
NSError error1 = null;
var content = request.Content;
var updatedContent = content.Update(intent, out error1);
contentHandler(updatedContent);
Post not yet marked as solved
On iOS14 or later, the body of push notifications is cut off at around 256 characters.
For iOS13 or earlier, the entire body was displayed normally and the issue did not occur.
Do you have any idea of the cause, such as a change in Apple's APNs or OS specifications?
There is a limitation that "APNs support only 4096 bytes for the entire payload of a push message," but the notification size when an event occurs is 4096 bytes.
We have confirmed that the size of the notification when an event occurs does not exceed 4096 bytes.
Are there any other restrictions on the number of characters used to send push notifications?
Post not yet marked as solved
For creating APNS certificate, we use a signed CSR from our MDM vendor which is a .plist file. We were using this for quite some years now. But currently APNS portal throws error saying invalid file type (as attached below)
Is the Portal updated to support only .csr / .txt / .rtf?
Can anyone help to use the correct file format.
(P.S: Works if we edit the extension & upload it)
Post not yet marked as solved
Notification to my app stopped working recently. According to the server response the message was delivered without errors but nothing is going through on device.
We are using a Push Notification Key to send Notifications.
I have recently migrated my account from Personal to Business. Not sure if that had an influence.
I also did create a new key but that also did not make any difference.
Post not yet marked as solved
We use remote push notification with content available = 1, as per document it will wake up app, but it doesn't work properly, sometimes the app doesn't wake up.
I have observed this behaviour mostly on iOS 15.
We use this mechanism to send device location to our server.
Why remote push notification doesn't wake up my app all the time?
Post not yet marked as solved
My goal is to get the push notifications while
I get the following error
The following Swift pods cannot yet be integrated as static libraries
when I run pod install . I have tried the foolowing methods.
pod 'GoogleUtilities', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
I also tried with
use_modular_headers!
But it didn't work out.
Could some one say a solution to this issue?
Post not yet marked as solved
I want to enable push notifications in my iOS app. I followed the resp. walkthrough as closely as possible.
To test things, I tried the command line approach first like described here: https://developer.apple.com/documentation/usernotifications/sending_push_notifications_using_command-line_tools
The APNS server responds with 200/OK, but no notification will ever arrive at my device.
I definitely assume my request is correct; if I tamper with the device token (e.g. by altering its last digit), the server responds with 400/BadDeviceToken like one would expect.
This is what I get from the APNS server:
curl -v --header "apns-topic: $TOPIC" --header "apns-push-type: alert" --header "authorization: bearer $AUTHENTICATION_TOKEN" --data '{"aps":{"alert":"test"}}' --http2 https://${APNS_HOST_NAME}/3/device/${DEVICE_TOKEN}
* Trying 17.188.138.73...
* TCP_NODELAY set
* Connected to api.sandbox.push.apple.com (17.188.138.73) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=api.development.push.apple.com; OU=management:idms.group.533599; O=Apple Inc.; ST=California; C=US
* start date: Feb 8 21:41:22 2021 GMT
* expire date: Mar 10 21:41:22 2022 GMT
* subjectAltName: host "api.sandbox.push.apple.com" matched cert's "api.sandbox.push.apple.com"
* issuer: CN=Apple Public Server RSA CA 12 - G1; O=Apple Inc.; ST=California; C=US
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fe09f80f200)
> POST /3/device/49C52E009C0107AB0ACCF178703E32790B4F3F155E7897F1F4ABAA3B1D9170D8 HTTP/2
> Host: api.sandbox.push.apple.com
> User-Agent: curl/7.64.1
> Accept: */*
> apns-topic: de.nexoft.viveto
> apns-push-type: alert
> authorization: bearer eyAiYWxnIjogIkVTMjU2IiwgImtpZCI6ICJaTTNDR0hTVEQ5IiB9.eyAiaXNzIjogIjNaVzhDUVZEWUoiLCAiaWF0IjogMTYyOTI5NjI1NCB9.MEYCIQCXP7L0-v_wY8F_WGFuZ-phJomzyO-43k0b7Xl9dvosVwIhANErbCHYfnG5ccfKTl14BCEhyWbDzPZSSLkJrSaQhCSb
> Content-Length: 24
> Content-Type: application/x-www-form-urlencoded
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 1)!
* We are completely uploaded and fine
* Connection state changed (MAX_CONCURRENT_STREAMS == 1000)!
< HTTP/2 200
< apns-id: 4C4AF738-9624-4643-8F76-18FFAD630C4F
<
* Connection #0 to host api.sandbox.push.apple.com left intact
* Closing connection 0
Post not yet marked as solved
I would like to know whether the following items can be implemented with swift and whether there are any restrictions on passing the Apple side inspection.
Almost all of them are DND-related, but the part I understood is written in parentheses next to the function or function, and I want to know if it is possible if that function is used. I'm a beginner in swift development, so I can't find a solution with a search, so I'm writing this.
Don't ring the phone
Event catch O (CallKit) when making a call or during a call
Turn off all notifications except for allowed first-party apps
Send a notification when the company's app is in the background (shoot API communication) O
Check whether the current phone is sound, vibration, or silent O (AVAudioSession)
Forced switching of sound, vibration, and silence O (AVAudioSession)
Turn off SMS notifications
Post not yet marked as solved
We have exactly the same issue that was posted in this article
APNS portal not working | Apple Developer Forums
https://developer.apple.com/forums/thread/698419
We downloaded the csr from our MDM to do the renewal of the cert, log into the apple push cert renewal portal, click to renew the cert. Choose the csr downloaded earlier but then the upload button just doesn't do anything at all. Page is not loading or showing any errors at all.
Tried different browsers, different computers with the same result on all of them the page just doesn't seem to do anything.
Post not yet marked as solved
All our applications listed below, once installed in padOS15 (iPad mini 6 15.4.1) are not receiving any remote push notifications.
We built our apps in XCode13.2.1. I also tried to install the latest XCode13.3.1 in macOS Monterey, but I got the same problem.
It has no problem when installed on different devices and versions.
Our apps:
CLOMO SecuredBrowser for iFilter
CLOMO SecuredMailer
CLOMO SecuredDocs
CLOMO SecuredContacts
This is how to replicate it:
Start the app
Press the home button and the app goes to the background
I change the profile settings on our server-side
Wait for the remote push notifications. (the remote push notifications are received on other devices but not on this device)
Expected result: remote push notifications should be shown on the device.
When I checked the console log, I found that com.apple.Preferences removed delivered notifications as shown below.
SpringBoard [com.apple.Preferences] Removing delivered notifications
I have a apns request where i specify expiration of 5 min.
When the notification is raised device isn't online, and after getting device online after 2 min, i still don't get a notification.
Ideally if i do get the device online after 5 min and not receive notification that's expected.
If i remove the expiration all together and then do same steps as above, i always receive the notification.
Here's a curl request i am making:
curl -v -d '{"aps":{"alert":{"title":"Device Status","body":"some body"}, "badge":0}}' -H "apns-topic: com.app.app" -H "apns-priority:10" -H "apns-expiration:300" -H "authorization: bearer Token" --http2 https://api.development.push.apple.com/3/device/deviceId
Any suggestion why this is happening when expiration is specified and any work around for achieving this