title: ID not integer... EasyAPNS
body: <p>I have a method that get's all devices that share a specific ID. Foreach of those device UID's, I am trying to send a APN (Apple Push Notification) using the easyAPN's class.</p>
  
  <p>The method that is having the problem is $apns->newMessage($id);</p>
  
  <p>It seems to think I am not passing a valid integer for $id.</p>
  
  <p>The $id is an array like so Array ( [0] => 1 ) </p>
  
  <p>I have also tried passing just the value of the array like so $apns->newMessage($id[0]).</p>
  
  <p>No matter what I do.. I keep getting this error...</p>
  
  <p>"Notice: TO id was not an integer. 1) Messages_model::send_apns -> File: sendMessage.php (line 28) 2) APNS::queueMessage -> File: messages_model.php (line 195) 3) APNS::_triggerError -> File: class_APNS.php (line 599)"</p>
  
  <p>Here is my method... please let me know where I've gone wrong with the $id.</p>
  
  <pre><code>function send_apns($data)
  {
      include 'apn_classes/class_DbConnect.php';
      include 'apn_classes/class_APNS.php';
  
      $message = new Messages_model();
      $db = new DbConnect();
      $db-&gt;show_errors();
      $apns = new APNS($db);
  
      //get uid's for aid
      $sql = "SELECT `devices`.`uid` FROM `devices` WHERE `devices`.`aid` = '".$data['target']."'";
      //echo $sql;
      $query = mysql_query($sql);
      if(mysql_num_rows($query))
      {
      while($uid_data = mysql_fetch_array($query))
          $uids[] = array(
              "uid" =&gt; $uid_data['uid']
          );
      }
  
      //make sure there is a uid
      if(!empty($uids))
      {
          //check the device apn pid
          foreach($uids as $uid)
          {
              $sql = "SELECT `apns_devices`.`pid` FROM `apns_devices` WHERE `apns_devices`.`deviceuid` = '".$uid['uid']."'";
              //echo "$sql";
              $query = mysql_query($sql);
              if(mysql_num_rows($query) &gt; 0)
              {
                  while($pid_data = mysql_fetch_array($query))
                  {
                      $pids[] = array(
                          "pid" =&gt; $pid_data['pid'],
                      );
  
                      if(!empty($pids))
                      {
                          foreach ($pids as $pid)
                          {
                              $id = array($pid['pid']);
                              print_r($id);
                              //Send APN
                              $apns-&gt;newMessage($id[0]);
                              $apns-&gt;addMessageBadge(128);
                              $apns-&gt;addMessageAlert($data['message']);
                              $apns-&gt;addMessageSound('chime');
                              //$apns-&gt;addMessageCustom('acme2');
                              $apns-&gt;queueMessage();
                              $apns-&gt;processQueue();
                          }
                      }                   
                  }
              }
          }
  
      }
      else 
      {
          echo "Device Does not Exist";
      }
  
  
  
  }
  </code></pre>