"$message->setBadge(0);" doesn't work since iOS5

297 views
Skip to first unread message

Daniel Gura

unread,
Oct 28, 2011, 12:11:38 PM10/28/11
to apns-php
Hello everbody,

the statement "$message->setBadge(0);" in the following source code
doesn't work since iOS5:

try
{
// Instantiate a new Message with a single recipient
$message = new ApnsPHP_Message($row['iPhoneDeviceToken']);

// Set badge icon to "x"
$message->setBadge(0);

// Set the expiry value to x seconds
$message->setExpiry(5*60);

// Add the message to the message queue
$push->add($message);
$i++;
}
catch (Exception $e) { /* nothing to do... */ }

Does someone has experience with this and can help me?

thanks in advance,
Daniel

prim...@gmail.com

unread,
May 29, 2012, 6:30:08 PM5/29/12
to apns...@googlegroups.com
I couldn't get it to remove the badge number when sending a zero either, but I was able to get it working by editing the Message.php file like so:

Replace:
if (isset($this->_nBadge) && $this->_nBadge > 0) {

With:
if (isset($this->_nBadge) /*&& $this->_nBadge > 0*/) {

sharmila kishan

unread,
Aug 10, 2014, 9:42:07 AM8/10/14
to apns...@googlegroups.com, prim...@gmail.com
Thanks I got solve my problem
Reply all
Reply to author
Forward
0 new messages