如何将序列号传递给设备

时间:2013-04-05 07:02:41

标签: ios6 passbook

现在我正处于设备向webServiceURL/version/devices/deviceLibraryIdentifier/registrations/passTypeIdentifier?passesUpdatedSince=tag

生成GET请求的步骤中

服务器如何发送传递序列并发送最后更新的/ tag;所以我需要将时间戳转换为字符串,因为lastUpdated是字符串?这是来自控制台的错误: Apr 5 13:45:24 CamMobs-iPod4 passd[21] <Warning>: Get serial #s task (for device b6511c0dd47d04da449ce427b27fea74, pass type pass.cam-mob.passbookpasstest, last updated (null); with web service url http://192.168.1.202:8888/passesWebserver/) encountered error: Server response was malformed (Missing response data)

1 个答案:

答案 0 :(得分:1)

查询您的数据库并识别与deviceLibraryIdentifierpassTypeIdentifier匹配且自passesUpdatedSince标记以来发生更改的序列号(如果有)。把它们放在一个数组中。

然后将该阵列发送回设备,如果没有需要更新的序列号,则发送204响应。

$serialsArray = array("abc123", "dec456"); // this array should be populated by your database.

if (!empty($serials)) {
    echo json_encode(array('lastUpdated' => (string)time(), 
                           'serialNumbers' => $serialsArray));    
} else {
   // No serials need updating so send a 204 response
}