iOS Push Notifications issue

Hello,

First of all thank you Backendless for saving me from Parse’s shoutdown.
Every thing is working like a charm … But I have the push notification issue in iOS
My app’s idea is a shopping app. so when a user buy an item… a push notification message should be sent to the admin, which is me and anther person, the other person and I have created a channel called Admin. and we have registered our devices in it with this code

@try {
[backendless initAppFault];
[backendless.messagingService registerDevice:@[@“Admin”];
backendless.messagingService.pushReceiver = self;
}
@catch (Fault *fault) {
//[self showAlert:fault.message];
NSLog(@"-------%@", fault.message);
}

The Channel were created and our devices appears in the devices section and they’ve registered fine with their tokens …
But When I try to send a push notification to it… nothing happen until I open the app and close it again, then send it again and push is here … but if I left the app closed for one hour and send a push again … nothing appears, I’ve tried the Dashboard console as well but nothing, before asking me … my Certs are fresh generated and they are in the correct place. Im using the native header to send a native push like these

“ios-sound”:“default”,“ios-badge”:“1” etc

the code that will send a push looks like this

DeliveryOptions *deliveryOptions = [DeliveryOptions new];
[deliveryOptions pushBroadcast:(/*FOR_ANDROID | */ FOR_IOS)];
[deliveryOptions pushPolicy:PUSH_ONLY];

NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] init];
[tempDict setObject:UserNameTextField.text forKey:PUBLISHER_NAME_HEADER];
[tempDict setObject:@"1" forKey:@"ios-badge"];
[tempDict setObject:@"default" forKey:@"ios-sound"];
[tempDict setObject:@"1" forKey:@"ios-content-available"];
PublishOptions *options = [PublishOptions new];
options.headers = tempDict;

[backendless.messagingService
 publish:@"Admin"
 message:[NSString stringWithFormat:@"%@ Submitted An Item For Review.", UserNameTextField.text]
 publishOptions:options
 deliveryOptions:deliveryOptions/*[DeliveryOptions deliveryOptionsForNotification:PUSH_ONLY]*/
 response:^(MessageStatus *res) {
     NSLog(@"showMessageStatus: %@", res);
 }
 error:^(Fault *fault) {
     NSLog(@"sendMessage: fault = %@", fault);

 }];

Please let me know if Im doing something wrong that the push notification wont deliver if the app is closed after one hour and up ? Or something else with the backend ?

As long as you do not call in your app:

[[UIApplication sharedApplication] unregisterForRemoteNotifications];
then the push notifications should arrive. Do you see the device on the Devices tab in Backendless console?

Sure Im not using this code to unregister the device from push … As I mentioned above, Yes I do see my device and my friend’s device in the Admin Channel.

Im not saying Im not getting push at all. My problem is if the app closed for 2 hours lets say , and send a push, the push wont arrive until I open the app for a second. then close it, then send a push, the push arrive ! Im totally sure that Im using the Native iOS Push and Im not using the pub/sub service …

What if you close the app, let it be closed for 2 hours and then send a push from Backendless Console? Does it arrive then?

No it doesn’t, until I open the app then close it, send a push from Console then it arrives, Im using the native headers such as “ios-sound”:“default”,“ios-badge”:“1” etc …

I always make sure that Im selecting a push notification and select the iOS Devices etc…
Dear Mark, Backendless is really amazing and Im really happy with all your support and your very clear Docs. But this issue is driving me crazy :confused:

Which channel do you publish a push notification from console?

Also, try using the “ios-alert” header in Backendless console.

Im using the “Admin” Channel which is created for my device and my friend’s device only, and our devices appear there with their tokens and no expiry date, I will include this header and I will check what could happen, hopefully it will fix this issue ? but could you please tell the deference if I used this header or direct me to a document for it.

Thank you very much for your valuable support.

There are three types of supported notifications in iOS:

    message popup (done with the "ios-alert" header) badge update (done with the "ios-badge" header) sound (done with the "ios-sound" header)

Hello Mark

I still have the same issue, its not solved by using the ios-alert, what we can do at this point ? and it looks like there are 3 persons have the same issue …

Hi Fouad,

Are you using silent push notifications?