help : how to handle fatal errors while notifying multiple users

27 views
Skip to first unread message

Mauro Cherubini

unread,
Aug 11, 2017, 4:43:57 PM8/11/17
to Easy APNs
Dear All,

first of all THANK YOU for such an amazing project. It saved us countless hours and allowed us to use it for a University project on a budget.

I need help. I am trying to notify ~ 100 users and I wrote a loop to create the batch with APNS:

$db = new DbConnect(== details removed for this public post ==);
$db->show_errors();
$apns = new APNS($db);
//
foreach ($pidsList as $user) {
     $apns->newMessage($user);
     $apns->addMessageAlert($message);
     $apns->addMessageSound('bingbong.aiff');
     $apns->queueMessage();
}
//
$apns->processQueue();

The problem I am facing is that if say user # 25 has an invalid token or other similar problem, the process of the queue throws a PHP fatal error and the entire script stops:
e.g., 1024: APNS responded with command(8) status(8) pid(107).

What I would love to do is to have a way to better handle these situations, possibly continuing the execution of the code with the notification of the remaining users.
How can I do that?

I would be extremely grateful for any feedback / advice / idea.

Thanks SO MUCH
Reply all
Reply to author
Forward
0 new messages