Push Notification is not working (iOS)

okay . please let me know what is to be done to fix this issue

Starting iOS 13 the description attribute of the deviceToken changed to a different format:

{length=32,bytes=0x77fbced7d1d7274f0f963f251d16c980…c2fdef53dca78e3a}

instead of

0f23e3074532ddf22e44e5b8d286830db5d16485b5dfabb5d23355a24a7bc67c

iOS-SDK fixes were made in v 5.5.0 but you used v 4.0.29 till yesterday - thats why all those devices using iOS 13+ registered with incorrect token format.

Now, having the device running iOS 13+ and using iOS-SDK v5.5.0 the incorrect device token should update automatically.

I’ve checked and recorded a video - everything works fine.
On the video:

  1. I register my device using iOS-SDK v5.4.1 - it is registered with wrong token format.
  2. I update iOS-SDK to v 5.5.0 - device registers with correct token format and updates in the console.

And my device receives push notifications without any issues after token update.

I updated the backendless to v5.6.0 and now the device token is in correct format. But still i am having the push notification issue . I checked the push notifications in multiple devices and understood that the issue is only there in devices whose iOS version is above 13. When the push notification is received in iOS 13 device, notification delegates in app delegate should be called .But it is not happening in iOS 13 devices. Since the device Id is passed from backendless, is there any issue with device Id registered from iOS 13 devices? I think the mapping of device token and device Id that is done from backendless is not correct in iOS 13 devices.The issue is with the user device Id generated from the backendless. Please let me know if there is anything can be done from your side.

When push notification is sent from app , a header is passed to the backendless .

NSDictionary *androidHeaders = @{@“android-content-title” : @“READIResponse”, @“android-content-text” : message, @“ios-badge” : badgeCount, @“ios-sound” : @“alarm_loud.wav”};

Please see the screenshot below:

Do i need to pass any other attributes in this header? When i searched in google, i came to know that “apns-push-type” is required in the new iOS 13 devices.
Please see the link below:

Please let me know if any changes i have to make while passing the header when the push notification is sent.

Hello,

Of course, iOS devices require specific headers.
E.g.

let publishOptions = PublishOptions()
publishOptions.setHeaders(headers: ["ios-alert": "Alert message",
                                    "ios-badge": 1,
                                    "ios-sound": "default",
                                    "mutable-content" : 1,
                                    "attachment-url": "https://upload.wikimedia.org/wikipedia/commons/c/c9/Moon.jpg"])

notification delegates in app delegate should be called .But it is not happening in iOS 13 devices.

You can download the code generated project for iOS push notifications

it has all necessary methods in AppDelegate to handle push notifications for all versions of iOS (from 8 to 13 included).

Since the device Id is passed from backendless, is there any issue with device Id registered from iOS 13 devices?

Nope, there shouldn’t be any issue. Backendless is just an intermediary - all pushes also come through the APNs and I’ve tested pushes with both iOS 12 and 13 without any problems.

I think the mapping of device token and device Id that is done from backendless is not correct in iOS 13 devices.

In my previous comment I’ve attached a link to the video showing the work with iOS 13 device. All push notifications are received correctly before and now.

I can recommend you to create a new test application, register your device there, connect a certificate, download a code generated project for push notifications, setup it as necessary (development/production mode according to your certificate) and check whether it works with your device.

I checked with 5 devices. 3 devices were iOS 13 version and 2 devices were iOS 12.4 and 12.4.5. When i send the push notification, alert was received in the 2 devices whose iOS versions are 12.4 and 12.4.5. But didn’t receive the alerts in iOS 13 devices. I tested the same in multiple scenarios and still the alerts were not received in iOS 13 devices. The code given in the backendless for the push notification is deprecated. In the app delegate, there is a method didReceiveRemoteNotification for receiving the push notification . But this function is deprecated and will not support in iOS 13 devices. So i have added the UNUserNotification delegates as shown below:

The code given in the code generation in backendless does not have all necessary methods. So i added the above methods for supporting iOS 13 devices. Still the push notifications are not received.

The project generated for push notifications doesn’t require any changes in AppDelegate or somewhere else.
Here is my step by step video (sorry for quality, Monosnap avoids to upload too large videos):

HERE IS STEP BY STEP VIDEO

  1. Upload my certificate.
  2. Download the autogenerated project for push notifications and install Backendless dependency.
  3. Change project’s Bundle Id and Team.
  4. Run the app. The device running iOS 13.4.1 is registered in Backendless (I’ve used QuickTime Player to mirror my iPhone screen).
  5. Try to send push notification from templates and notification is received in a moment.

I created a new test application named TestApp and uploaded the certificate. Also i downloaded the autogenerated project for push notifications from backendless and installed backendless. Changed the Bundle Id and Team, Do i need to add the API key and Application Id in the project to link my project with the TestApp? After running the project in my device, device was not registered in backendless.

Of course, App Id and API key in your project should be the same as in your app. When you download the autogenerated project this values are set automatically.

Earlier i downloaded the project from ReadiResponse application. Now i downloaded a new push notification project from test application TestApp and did the same that you have told me to do . Now the device is registered in backendless as shown below.

After that , I sent the push notification from backendless to my device . But my device didn’t receive the push notification. I am not understanding why this issue is still not resolved. Since you have received the push message in your iOS 13.4.1 device, why my device is not receiving the push notification ? This issue exists for other iOS 13 devices also.

We cannot resolve the issue that we cannot reproduce.

Is your app in foreground or background when you’re sending notification?
If its in the foreground do you receive any information in this method or this one?

I tried in both cases foreground and background . I put a break point in didReceiveRemoteNotification method and this method was not called when the push notification is sent to my device.

Is it possible for you to test the push notification in my device if I share the device UDID to you? Since my device is receiving the push messages from other push notification testing applications, the issue exists only when the push notification is sent from backendless. Please let me know.

If I understand correctly, I should send push notification from your app to your device using my certificate, right?
If so - please create a new test app with only yours registered device and provide your APP ID and UDID.
I think it’s possible.

I have already created a test application “TestApp” in backendless and my device is registered in it.
App Id - 03283B34-4F04-04DB-FF5F-17F207E56100
UDID - 68eedb2194bd28abdb5c075c3f2a27b8ba1f634f

I’ll check it as soon as possible, because I don’t have access to certificates and devices right now - waiting our team Account Holder agree to the Apple Program Agreement.

Okay . Thank you

Hmm, I just realised that I cannot check pushes this way - if you want to check your device with our certificate you should install our version of iOS project with our Bundle Id, and it is available only for our team members.
Unfortunately we cannot add you as our member, sorry.

I can only advise you to check your device, certificate or project carefully, issue maybe present somewhere on your side, because we don’t receive any reports about push notifications problems from other users and everything is working fine with our devices.