iOS push notification


There’s problem sending push notification.
I am using Messaging service only for sending push notification.

  1. sending iOS push from backendless console
    I’ve managed send push notification to iOS devices using default channel.
    However, push is not sent channel that user created.
    For subscribing to a channel, I call the following API - it succeeds all the time
    -(void)subscribe:(NSString *)channelName response:(void(^)(BESubscription *))responseBlock error:(void(^)(Fault *))errorBlock;

I even tried calling following API to see test if passing subscription option has any effect (examples codes from code gen passes empty subscription options)

SubscriptionOptions *subscriptionOptions = [SubscriptionOptions new];
-(void)subscribe:(BESubscription *)subscription subscriptionOptions:(SubscriptionOptions *)subscriptionOptions response:(void(^)(BESubscription *))responseBlock error:(void(^)(Fault *))errorBlock;

  1. sending iOS push from device.
    I am testing with two iPhones, each subscribes to channel named after userId, which is done in the same way in code gen chat example.
    I tried to send push notification from one device to another.
As explained in above link, I called below API - there’s no error, push is not sent, and message is not displayed in console.
-(void)publish:(NSString *)channelName message:(id)message deliveryOptions:(DeliveryOptions *)deliveryOptions response:(void(^)(MessageStatus *))responseBlock error:(void(^)(Fault *))errorBlock;

So I tried calling below API - there’s no error, push is not sent, but sent message is displayed in console.
-(void)publish:(NSString *)channelName message:(id)message publishOptions:(PublishOptions *)publishOptions response:(void(^)(MessageStatus *))responseBlock error:(void(^)(Fault *))errorBlock;

Calling below code returns no error, push is not sent, message is not displayed in console.
(MessageStatus *))responseBlock error:(void(^)(Fault *))errorBlock;
-(void)publish:(NSString *)channelName message:(id)message publishOptions:(PublishOptions *)publishOptions deliveryOptions:(DeliveryOptions *)deliveryOptions response:(void(^)(MessageStatus *))responseBlock error:(void(^)(Fault *))errorBlock;

  1. For sending only push notification, the article explains to use A) (deliveryOptions only), but I thought C)(deliveryOption + publishOption) is one for push notification. Unless publish options is set for a message, how do I set badge count, sound, etc?

  2. For ios-sound, “default” is one for default sound as explained in below apple documentation. But reading from backendless article, it should be bytes of array for the sound or sound URL. Is it okay to send “default” as value of “ios-sound” to play default sound?
    “Sets either a URL for the sound notification to play on the device or an array of bytes for the sound to play.”

FYI, I set options in following way, however, I tried to add, remove, change some of options to see if it works.
DeliveryOptions *deliveryOptions = [DeliveryOptions new];//[[DeliveryOptions alloc] init];
[deliveryOptions pushBroadcast:IOS];//ALL];
[deliveryOptions pushPolicy:PUSHONLY];

PublishOptions *publishOptions = [PublishOptions new];//[[PublishOptions alloc] init];//
NSMutableDictionary *headers = [[NSMutableDictionary alloc] init];
[headers setObject:@"test" forKey:@"ios-alert"];
[headers setObject:@1 forKey:@"ios-badge"];
[headers setObject:@"default" forKey:@"ios-sound"]; 

[headers setObject:@1 forKey:@"ios-content-available"]; 

Thanks in advance


Hi Scott,

There are 2 mechanisms for delivering messages to devices:

    Native push notifications - can be delivered to a device even when app is not running Messages delivered via publish/subscribe messages - delivered to your app while it is running.
In your post you refer to the "subscribe" method which belongs to (2), yet you're talking about "push notifications" which is (1). Could you please clarify which mechanism you really need?


Hi Mark,

Thanks for update.

I see there’s difference between 1 and 2. Well backendless is little bit different from what I’ve used. Previous baas does have same subscribe/publish which actually send pushes to target channel regardless of app state. And besides, push notification is part of messaging service, it’s kind of confusing for me.

I presumed sending message with push option would send push regardless of app state - most of users would want this because there’s no way to notify user when app goes in background. Also if push is sent only to active users, then sender has to check if user is active or not: if not active, send with 1) otherwise send with 2).

Anyway my answer to your question is (1) native push notification.
Do I need to use push to device using below API for 1)?

-(MessageStatus *)publishMessageAsPushNotification:(NSString *)message forDevice:(NSString *)deviceId

If true, then I would need to save deviceId for each your? I really don’t want to save deviceId to Users table.


Hi Scott,

For native push notification you can use the method, which don’t require deviceId option:

-(MessageStatus *)publish:(NSString *)channelName message:(id)message publishOptions:(PublishOptions *)publishOptions deliveryOptions:(DeliveryOptions *)deliveryOptions;

For example:

PublishOptions *options = [PublishOptions new];
options.headers = @{@"publisher_name":@"Anonymous", @"ios-badge":@"1", @"ios-sound":@"Sound12.aif"};

DeliveryOptions *delivery = [DeliveryOptions deliveryOptionsForNotification:PUSHONLY];

MessageStatus *res = [backendless.messagingService publish:@"default" message:text publishOptions:options deliveryOptions:delivery];

You can try the sample “PushNotify” from our BackendlessDemos package ( to investigate how it works.

Please see our online documentation about messaging ( for setting up your own backend and iOS application to support native push notification.


Hi Slava,

If you look at my first question, I already tried that.
I tried again now, but it doesn’t work for channel that user created.
There’s no problem sending push notification to default channel.
Sending push notification to default channel from console or from iOS device works.

Sending push notification to user created channel from console does or from iOS device does not work.


There’s typoSending push notification to user created channel from console or from iOS device does not work.

“Backendless delivers messages marked as push notifications published to the channels to all devices registered with the channels. If no channels specified, Backendless registers the device with the “default” channel. If the call references a non-existing channel, Backendless creates the channel and registers the device with it. Registration expiration is a point in time (expressed as a timestamp) when the device registration should expire. Backendless removes the device registration at the specified time and device no longer receives published notifications.”

So, you can create the own channel, “typoSending” for example:

[backendless.messagingService registerDevice:@[@“typoSending”]];
and all devices, which have been registered for this channel, will get the push notifications.

You can see this doc section -


Hi Slava,

Thanks for quick reply.
Now I get it. There’s bit of confusion though.
Before, I only called registerDeviceToken and subscribe, but channel name that I am subscribing, appears on the console. So I thought I’ve created channel which I am subscribing.
And besides, there’s no line of code uses registerDevice in the example, there’s only subscribe.

So from

[backendless.messagingService registerDeviceToken:tokenStr response:^(NSString* registrationId)]

[backendless.messagingService subscribe:[UserData sharedInstance].uid response:^(BESubscription *responseBlock)]

I changed to
[backendless.messagingService registerDeviceToken:tokenStr response:^(NSString* registrationId)]

[backendless.messagingService registerDevice:@[[UserData sharedInstance].uid]

I’ve removed subscribe call and it still works - I figured that registerDevice creates channel automatically registers creator as subscriber.

If I’m wrong please let me know.

Thanks & Regards,

Hi Scott,

1). The method “subscribe” is used by publish/subscribe mechanism (2) - native push notification (1) don’t need it.
2). Yes - “registerDevice creates channel automatically registers creator as subscriber”.


Hi Slava

Thanks for clarification.

Hi, how can I send a Push Notification for selected channels from Web Console?

If a send a push notification to one channel, and after the same message to another channel, the user suscribed to this channels will receive 2 push notifications?

In parse I can send 1 push notification and select some channels :

“channels”: {
“$in”: [

Sergey thanks for reply but in this link I cant see a way to send a single push notification for selected channels.
In web console I only can send a message to one channel, and after send the same message to another channel.

Hi, I have a problem with push notifications now.

I have more than 1.000 deviceToken registered in all my channels (in backendless), but when I send a notification from web-console in any channel to iOS-Devices the push does not arrive.
Only if I send a push notification to a selected device the push notification works…

Maybe a backendless server bug?

Hi Juan,

You could investigate our Swift3/iOS10 sample project.
Hope it will be helpful for you.

Slava (19.31MB)

Thank you for reply.

I am using Xcode 7.3.1 and iOS 9.3 target.
But I still thinking that is a web-console problem because all the process to suscribe to a channel from device, register the token-id in web-console is working perfectly.

Ok, Juan, please create a new topic with this issue, we will create an internal task for it.

Ok, thank you for your support.

Have a nice day.

You could update the latest Backendless SDK (pod 3.0.42 release).

Interactive Push Notification is fixed.