我使用带有Codeigniter的ApnsPHP库来发送针对iOS的通知推送。现在,我对下一个错误感到有些绝望:
[Mon Jun 15 16:22:59.480063 2015] [:error] [pid 1820] [client 192.168.1.139:4707] PHP Fatal error: Uncaught exception 'Exception' with message 'Class file '/var/www/html/kids_book/application/models/CI/Exceptions.php' does not exists' in /var/www/html/kids_book/application/models/ApnsPHP/Autoload.php:20\nStack trace:\n#0 [internal function]: ApnsPHP_Autoload('CI_Exceptions')\n#1 [internal function]: spl_autoload_call('CI_Exceptions')\n#2 /var/www/html/kids_book/system/core/Common.php(143): class_exists('CI_Exceptions')\n#3 /var/www/html/kids_book/system/core/Common.php(481): load_class('Exceptions', 'core')\n#4 /var/www/html/kids_book/application/views/notificacion/add_notificacion.php(102): _exception_handler(8, 'Undefined varia...', '/var/www/html/k...', 102, Array)\n#5 /var/www/html/kids_book/system/core/Loader.php(833): include('/var/www/html/k...')\n#6 /var/www/html/kids_book/system/core/Loader.php(419): CI_Loader->_ci_load(Array)\n#7 /var/www/html/kids_book/application/controllers/notificacion.php(117): CI_Loader->view('notificacion/ad...', Array)\n#8 [internal function]: Notificacion->add_notificacion()\n#9 /v in /var/www/html/kids_book/application/models/ApnsPHP/Autoload.php on line 20, referer: http://192.168.1.132/kids_book/index.php/notificacion/add_notificacion
我在数据库中添加通知时出现此错误,并且库尝试将推送通知发送到设备。老实说,我不知道为什么会这样。我会感激任何帮助。提前谢谢。
型号:
class Push_model extends CI_Model {
public function __construct() {
parent::__construct();
$this->load->database();
}
public function push_notificacion_ios($keys) {
$count = count($keys);
date_default_timezone_set("America/Caracas");
require_once 'application/models/ApnsPHP/Autoload.php';
$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_SANDBOX, "application/models/notificacionesPUSH.pem"
);
$push->connect();
for ($i = 0; $i < $count; $i++) {
$message = new ApnsPHP_Message($keys[$i]);
$message->setBadge(1);
$message->setText('Tiene una nueva notificación de Kids Book');
$message->setSound();
$message->setCustomProperty('key', 1);
$message->setExpiry(30);
$push->add($message);
}
$push->send();
$push->disconnect();
}
PD:抱歉我的英语很糟糕,而不是我的母语。