Support Topics Documentation Slack YouTube Blog

Push Notification is not working (iOS)

We have two applications in IOS created for QA and production purposes. The production app is the replica of the QA app. We are able to send push notification from the QA app and is working fine.But push notification is not working in production build.

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

5.6.46

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

Objective-C (v4.0.20)

Application ID

E2380C63-B49A-5F86-FF77-77B2DC8DB000

Hello @Kevin_McClain,

I’ve checked push notifications with production certificate and everything works fine.
Please check your project settings.
Maybe this topic can be helpful…

Regards,
Olha

Okay , I will check again and get back to you

iOS distribution certificate was expired on January. So i created a new distribution certificate and released a new build to the App store on Feb 8. But in the new released build, push notifications are not working. Is the push notification issue related to the new iOS distribution certificate? Do i need to change any certificate in backendless ?

Yes, you should upload a new certificate in Backendless.

Regards,
Olha

I had uploaded the certificate in backendless and push notifications are working fine in some devices . But the push notifications are still not coming in some of the devices. Even though the user device id is updated in backendless when the alert is sent, push notifications are not received . This issue is there in some of the devices. Please let me know the reason why push notifications are not received in some devices. Please note that no code changes were made to have the push notification issue.

Having a lack of information about the devices that don’t receive notifications it’s not possible to say what’s going wrong. On our side push notifications work fine on the test devices running iOS 12 and iOS 13.

Regards,
Olha

I tried to send the push notification to my device from backendless. But the notification was not received in my device… Is it possible to send push notification to only one device from backendless? When i am testing the push notifications from backendless, notifications are send to a certain channel so that all the devices in that channel will receive the notification.
Please let me know if there is any way to send the push notification to only my device from backendless. Since this issue is only for some devices(including my iPhone), i wish to test the push notifications in only those devices.

If you’re using push templates you can specify devices as the segment:

or you can target individual devices using API.

Regards,
Olha

An error message is shown when i tried to add the device id in the segment colomn.

it should match the sql syntax as on the screenshot I’ve attached above:

deviceId = 'XXXXXXXXX' 

do you have ' ' around your deviceId?

Thanks. But still my iPhone device didn’t receive the push notification . When I tried to send the push notification to my device using NWPusher and then my iPhone received the alert. But when i am sending the push notification from backendless, alert is not received . Please let me know what is to be done

I think the backendless is not accepting the deviceId i have entered. Because , when i added my deviceId, it is still showing the number of recipients as zero.
My device Id is BD8D9F3C-4A5B-8781-FFE8-C1D00F0A2400

Hello @Kevin_McClain

Make sure there is a data object with this device id in the DeviceRegistration Table, if not you have to register the device before send any Push Notifications

Regards, Vlad

When I login from my iPhone, user device Id updated in the backendless is :
BD8D9F3C-4A5B-8781-FFE8-C1D00F0A2400::default

Why there is a “default” in the end of device id? Will that be the reason for not receiving the push notifications in my device?

After getting the deviceId in app delegate, i am storing the device Id in a local storage and when the push notification is sent, device Ids are taken and push notification is sent based on the user device Ids (not device token).The code to get deviceId from the device token is attached below:

Yesterday,I updated the backendless to 5.6.0 (Earlier it was 4.0.29) in my podfile. I did this to check whether the push notification issue was because of the older backendless version.But after updating the backendless , user device Id getting from the backendless is a default value ( BD8D9F3C-4A5B-8781-FFE8-C1D00F0A2400::default ). I have attached the screenshot of the code for getting the user device Id from the device token in the above comment. This user device Id is used for sending push notifications to the users. Please let me know what to be done.

The registerDevice() method response is not a deviceId but registrationId.
You can get deviceId this way:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
    [Backendless.shared.messaging registerDeviceWithDeviceToken:deviceToken responseHandler:^(NSString *registrationId) {
        NSLog(@"Device registration completed");
        NSLog(@"DeviceId = %@", Backendless.shared.messaging.currentDevice.deviceId);
    }];
}

This signature is from Swift-SDK but iOS-SDK has the same method.

Regards,
Olha

There is no registerDeviceWithDeviceToken method. Please see the screenshot below. These were the methods shown when i searched for registerdevice.

I tried another method such that I stored value of Backendless.shared.messaging.currentDevice.deviceId in a string variable and saved as userDeviceId in backendless. Now the userDeviceId is :
83BCD311-3962-48B6-AA2D-B24D12BAA261

Then i tried to send the push notification message from backendless to my device. As you had said yesterday, in the segment section , i gave deviceId = ‘83BCD311-3962-48B6-AA2D-B24D12BAA261’ and i send the push notification . But my iPhone didn’t receive the push notification.

Please see the screenshot below. This is how i send the push notification message from backendless.

The method you’ve selected on the screenshot is the method you need.
Some of the signatures are a little different and our documentation is made for Swift-SDK since iOS-SDK is deprecated.

Regards,
Olha