Ошибка ApnsPHP, в моем проекте codeigniter

У меня появляется эта ошибка, когда я отправляю форму с codeigniter, у меня не было этой проблемы раньше. Я просто проверял весь свой проект и заметил, что этот запрос не работает.
Некоторая помощь? Спасибо

Mon, 16 Mar 2015 12:11:32 -0430 ApnsPHP[4156]: ERROR: Unable to send message ID 1: Invalid token (8).
Mon, 16 Mar 2015 12:11:33 -0430 ApnsPHP[4156]: WARNING: Message ID 1 [custom identifier: unset] has an unrecoverable error (8), removing from queue without retrying...
Mon, 16 Mar 2015 12:11:34 -0430 ApnsPHP[4156]: ERROR: Unable to send message ID 2: Invalid token (8).
Mon, 16 Mar 2015 12:11:35 -0430 ApnsPHP[4156]: WARNING: Message ID 2 [custom identifier: unset] has an unrecoverable error (8), removing from queue without retrying...

контроллер:

public function add_notificacion() {
$data = array();
if (!empty($this->input->post('mensaje', TRUE))) {

if (($this->input->post('id_profesor', TRUE) != 0)) {
$id_profesor = $this->input->post('id_profesor', TRUE);
$this->load->model('Profesor_model', 'profesor');
$json_data = $this->profesor->gets_profesor($id_profesor);
foreach ($json_data as $fila) {
$nivel[] = $fila->id_nivel;
}
} else {
$nivel = $this->input->post('niveles', TRUE);
}
if (!empty($this->input->post('fecha_notificacion', TRUE))) {
$date = $this->input->post('fecha_notificacion', TRUE);
$date_formate = str_replace("/", "-", $date);
$fecha_notificacion = date("Y-m-d H:i", strtotime($date_formate));
} else {
$fecha_notificacion = '';
}
date_default_timezone_set('UTC');
$fecha = date('Y-m-d H:i:s', time());
$nino = $this->input->post('nino', TRUE);
$res = $this->notificacion->representante($nino);
foreach ($res as $item){
$representante[] = $item->id_representante;
}
$notificacion_data = array(
'mensaje' => $this->input->post('mensaje', TRUE),
'titulo' => $this->input->post('titulo', TRUE),
'id_nivel' => $nivel,
'fecha_notificacion' => $fecha_notificacion,
'fecha' => $fecha,
'tipo' => $this->input->post('tipo', TRUE),
'id_profesor' => $this->input->post('id_profesor', TRUE),
'id_colegio' => $this->input->post('id_colegio', TRUE)
);
if (!empty($notificacion_data)) {
$this->notificacion->add_notificacion($notificacion_data, $representante);
$dato = array("message" => "Se agrego la notificación exitosamente");
} else {
$dato = array("message1" => "Error al intentar agregar notificación");
}
$this->load->view('notificacion/add_notificacion', $dato);
}else{

$valor = $this->session->userdata("verified");
if (!empty($valor)) {
if (($valor["id_colegio"]) != 0) {
$id_colegio = $valor["id_colegio"];
$data["nivel"] = $this->notificacion->obtener_nivel($id_colegio, 0);
}
if (!empty($valor["id_profesor"])) {
$id_profesor = $valor["id_profesor"];
$this->load->model('Profesor_model', 'profesor');
$result = $this->profesor->gets_profesor($id_profesor);
$id_colegio = $result[0]->id_colegio;
$id_nivel = $result[0]->id_nivel;
$data["nivel"] = $this->notificacion->obtener_nivel($id_colegio, $id_nivel);

}
}
$this->load->view('notificacion/add_notificacion', $data);
}

}

Модель:

 public function add_notificacion($notificacion_data, $representante) {
$keys_ios = $keys_android = array();
$j = 0;

foreach ($notificacion_data["id_nivel"] as $item) {
$notificacion_data["id_nivel"] = $item;
$array[] = $item;
}
$count = count($array);
unset($notificacion_data["id_nivel"]);
$this->db->insert('notificaciones', $notificacion_data);
$id_notificacion = (int) $this->db->insert_id();

if (empty($representante)) {
$query = "SELECT id_representante FROM `representante` left join nino_padre using (id_representante) left join nino using (id_nino) where id_nivel IN (" . implode(",", $array) . ") group by (id_representante)";
$result = $this->db->query($query);
$tmp = $result->result();
$count = count($tmp);

for ($i = 0; $i < $count; $i++) {
foreach ($tmp[$i] as $valor) {
$representante[] = $valor;
}
}
}

foreach ($representante as $valor) {
$data["id_notificacion"] = $id_notificacion;
$data["id_representante"] = $valor;
if ($j < $count) {
$data["id_nivel"] = $array[$j];
}
$this->db->insert('notificacion_representante', $data);
$j++;
}
$this->email($representante, $notificacion_data);
$query = "SELECT key_ios, key_android FROM users ";
$query .= "where id_representante IN (" . implode(",", $representante) . ")";
$result = $this->db->query($query)->result();

foreach ($result as $item) {

if (!empty($item->key_ios)) {
$keys_ios[] = $item->key_ios;
}
if (!empty($item->key_android)) {
$keys_android[] = $item->key_android;
}
}

if (!empty($keys_ios)) {
$this->push->push_notificacion_ios($keys_ios);
}
if (!empty($keys_android)) {
$this->push->push_notificacion_android($keys_android);
}
}

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector