Question

I have quickblox almost working on ios. The last problem is when I send a push notification I get it on the sender too. Presumably this is not intentional?

Curiously when I look at the debug output from quickblox I see that it has repeated one of the receiver ids. The NSString I pass in toUsers is "678004, 681456, 683185"

[QBMessages TSendPush:message toUsers:receivers delegate:self];

and I see that in the initial Quickblox debug output

parameters:{
"event[environment]" = development;
"event[event_type]" = "one_shot";
"event[message]" = "payload=eyJhcHMiOnsiYWxlcnQiOiJEaXJrIFdvb2Qgc3RhcnRlZCB1c2luZyBCbG9jIHRvZGF5IiwibmV3cyI6MzQ0NDg1NTQ3OTEsInNvdW5kIjoiZGVmYXVsdCIsInBtdGlrIjoyfX0=";
"event[notification_type]" = push;
"event[push_type]" = apns;
"event[user][ids]" = "678004, 681456, 683185";

}

but then in the RestResponse debug output I see

body:<?xml version="1.0" encoding="UTF-8"?> <event> <active type="boolean">true</active> <application-id type="integer">4637</application-id> <created-at type="datetime">2014-01-23T17:02:40Z</created-at> <date type="integer" nil="true"/> <end-date type="integer" nil="true"/> <event-type>one_shot</event-type> <id type="integer">1073359</id> <message>payload=eyJhcHMiOnsiYWxlcnQiOiJEaXJrIFdvb2Qgc3RhcnRlZCB1c2luZyBCbG9jIHRvZGF5IiwibmV3cyI6MzQ0NDg1NTQ3OTEsInNvdW5kIjoiZGVmYXVsdCIsInBtdGlrIjoyfX0=</message> <name nil="true"/> <occured-count type="integer">0</occured-count> <period type="integer" nil="true"/> <updated-at type="datetime">2014-01-23T17:02:40Z</updated-at> <user-id type="integer">681447</user-id> <notification-channel> <name>apns</name> </notification-channel> <subscribers-selector> <environment>development</environment> <tags-query nil="true"/> <user-ids type="array"> <user-id type="integer">678004</user-id> <user-id type="integer">681456</user-id> <user-id type="integer">683185</user-id> <user-id type="integer">681456</user-id> </user-ids> </subscribers-selector> </event>

where the second user has been repeated, and the sender receives the notification. I don't know whether it would have any significance but one of the user is running on the simulator - wouldn't expect to see a notification there.

Was it helpful?

Solution

Let me explain what is going on here:

<user-ids type="array"> 
    <user-id type="integer">678004</user-id> 
    <user-id type="integer">681456</user-id> 
    <user-id type="integer">683185</user-id> 
    <user-id type="integer">681456</user-id> 
</user-ids> 

It means that 4 devices will receive this push notifications. User with ID 681456 has 2 devices. That's why you can see 2 same ids 681456 and 681456 here.

Look's like one of your receiver was subscribed on sender's device too.

You can check user's devices in admin panel and manage them - open Admin panel, Users module, edit user - you will see all user's devices enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top