iOS push notification partially works

Hi,

Backendless Version (3.x / 5.x, Online / Managed / Pro )

4.3.7 Pro

Client SDK (REST / Android / Objective-C / Swift / JS )

Swift

Application ID

We have 3 applications: dev, staging, live.
Live one works as expected.
Dev and staging had issues.

We are using hosted Backendless platform on version 4.3.7 and from time to time experiencing issues with push notifications on iOS app.

They stopped working, but only on some applications before the iOS certificates expire.

During troubleshooting we do perform the following actions:

  1. Re-upload the same certificate
  2. Re-start Taskman service.
  3. Create new certificate, and upload instead of previous.

And sometime ago 1st and 2nd step did fix the issues, without generating new certificate.

Currently it can’t fix the case on our dev and staging applications.
While live one still works without any issues.
The code between the environments is the same, no logic changes.

Push notifications are tested using BL UI messaging service or the API call like this:
curl --location --request POST ‘https://bl_domain/api/app_id/app_key/messaging/default’
–header ‘Content-Type: application/json’
–data-raw '{
“headers”: {
“ios-alert”: “test”,
“ios-sound”: “default”
},
“message”: “test”,
“pushSinglecast”: [
device_id
]
}

Uploaded certificate example is attached. Same fields were used before re-upload and after (tested as Sandbox type as well). Also we can ensure that push notifications were working 2 months ago in the same flow.

Screen Shot 2022-04-13 at 11.34.37 AM
The same certificate is in use and working in another chat messaging tools, installed and configured separately from Backendless.

Taskman logs contain the following message in similar time period when tests are done, but not in the exact moment:

[ERROR] - 2022-04-13 12:51:52,772 - from com.notnoop.apns.internal.ApnsConnectionImpl in Thread-44885 - Couldn’t connect to APNS server
java.net.ConnectException: Connection refused (Connection refused)
#011at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88)
#011at java.net.PlainSocketImpl.socketConnect(Native Method)
#011at com.notnoop.apns.internal.ApnsConnectionImpl.getOrCreateSocket(ApnsConnectionImpl.java:268)
#011at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
#011at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
#011at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
#011at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
#011at java.net.Socket.connect(Socket.java:589)
#011at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
#011at sun.security.ssl.SSLSocketImpl.(SSLSocketImpl.java:427)
#011at com.notnoop.apns.internal.ApnsConnectionImpl.sendMessage(ApnsConnectionImpl.java:327)
#011at com.notnoop.apns.internal.ApnsConnectionImpl.sendMessage(ApnsConnectionImpl.java:312)
#011at com.notnoop.apns.internal.ApnsServiceImpl.push(ApnsServiceImpl.java:46)
#011at com.notnoop.apns.internal.AbstractApnsService.push(AbstractApnsService.java:89)
#011at com.notnoop.apns.internal.ApnsServiceImpl.push(ApnsServiceImpl.java:36)
#011at com.backendless.services.notifications.ios.IOSNotificationGateway.send(IOSNotificationGateway.java:98)
#011at com.backendless.services.notifications.AbstractPushNotificator.pushMessage(AbstractPushNotificator.java:45)
#011at com.backendless.services.notifications.SendMessagesTask.doSendMessage(SendMessagesTask.java:334)
#011at com.backendless.services.notifications.SendMessagesTask.sendMessage(SendMessagesTask.java:237)
#011at com.backendless.services.notifications.SendMessagesTask.sendNotifications(SendMessagesTask.java:153)
#011at com.backendless.services.notifications.SendMessagesTask.execute(SendMessagesTask.java:118)
#011at com.backendless.taskman.Task.run(Task.java:128)
#011at java.lang.Thread.run(Thread.java:745)

Please, let us know of there is any other steps or actions that we can do to resolve the issue.

Hello @Irina_Prozhoha1,

We are really sorry you faced this issue. I’ve created an internal ticket BKNDLSS-28191 to investigate it.

Regards,
Olha

Hello Olha,

Thank you for taking care of this.
Looking forward to hearing from you.

Best Regards

hello @Irina_Prozhoha1

sorry for the long response, the old version of backendless is using the following URLs for apple push notifications:

gateway.sandbox.push.apple.com:2195 for sandbox
and gateway.push.apple.com:2195 for production

Sandbox is not available for me

➜  ~ telnet api.sandbox.push.apple.com 2195
Trying 17.188.137.190...
telnet: connect to address 17.188.137.190: Connection refused
Trying 17.188.138.71...
telnet: connect to address 17.188.138.71: Connection refused
Trying 17.188.138.70...
telnet: connect to address 17.188.138.70: Connection refused
Trying 17.188.136.189...
telnet: connect to address 17.188.136.189: Connection refused
Trying 17.188.138.73...
telnet: connect to address 17.188.138.73: Connection refused
telnet: Unable to connect to remote host

Meanwhile, production works fine:

➜  ~ telnet gateway.push.apple.com 2195
Trying 17.188.170.202...
Connected to gateway.push-apple.com.akadns.net.
Escape character is '^]'.
^]

So maybe apple stop the old apns service.

The latest version of backendless uses the following URLs:

SANDBOX_DOMAIN = "https://api.development.push.apple.com";
PRODUCTION_DOMAIN = "https://api.push.apple.com";

Hello, Sergey

Thank you for the troubleshooting and providing details.

According to our application configuration I see that we are selecting the “Production” type during upload certificate files on the Backendless web interface.
Screen Shot 2022-05-02 at 11.40.43 AM.png

Can you let us know, how else could it decide which apple server to use?

Hi Irina,

If your application is in the app store, you should use the Production certificate. However, if you’re developing your app and running it from Xcode, you should be using the Development certificate.

Regards,
Mark

Hi, Mark,

So it is based on the certificate itself, not the BL fields.

Then the dev type of certificate just won’t work anymore, right?

Best regards,
Irina

Hi Irina,

The dev certificate will not work when you publish your app to the app store.

Regards,
Mark

Hi, Mark,

Correct, we use a development apns certificate for test non-prod environments.
So these types of certificates won’t work on Backendless anymore regardless of “CERTIFICATE MODE” we select during certificate upload on Backendless.

Hi Irina,

When you upload a certificate to Backendless, you need to select what type of certificate it is:
App Settings - bookingAppTemplate - Backendless 2022-05-02 11-42-00

The selection must match the type of certificate you’re adding.

Regards,
Mark

Hi, Mark,

We tried both modes using the same certificate (Dev APNs cert).
Neither worked.

While the production app-store certificate is operational with Production “Mode” selected for the live app.

Regards,
Irina

Hi Irina,

Are you doing it in the Cloud version or your Pro installation (which is a rather old version I think)?

Regards,
Mark

Hi, Mark,

Hosted Pro v4.3.7.

So as Sergey mentioned, the sandbox apple url looks not reachable anymore.
Then it means dev certificates just won’t be working on our server.

Regards,
Irina

I am afraid so. Have you considered upgrading to the latest version of Backendless?