Passbook Update Push未在锁屏上显示 [英] Passbook Update Push not shown on Lockscreen

查看:152
本文介绍了Passbook Update Push未在锁屏上显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在玩苹果Passbook服务。我在所有设备上都有一个非常奇怪的行为。如果我通过APNS向设备发送推送,让他们知道某个传递有更新,他们会进行更新,但他们不会在设备的锁屏上显示任何通知。

I am playing with apples Passbook service. I have a really strange behaviour on all devices. If I send a push via APNS to the device to let them know that there is a update for a certain pass they do the update but they do not show any notification on the Lockscreen on the device.

现在我正在记录我的PHP-Webservice和APNS之间的整个通信。我总是回答headre 200和所要求的答案。 (第一个序列;第二个Pass.pkpass)和设备进行更新,因为我可以在存折应用程序中看到,但正如我已经说过,我没有在锁屏上得到任何通知。设备已正确设置,如本文所述:链接

Right now I am logging the whole communication between my PHP-Webservice and the APNS. I always answer with headre 200, and the requested answer. (1st Serials; 2nd Pass.pkpass) and the device does the update as I can see in the passbook app but as I already said I do not get any Notification on the Lockscreen. The Device is set up correctly as described in this article: a link

我这样做我的APNS请求:

and I do my APNS Request like this:

public function sendePushNotification($passTypeID, $debug = true)
{
// Zertifikat vorhanden ?
$certFullPath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "api/cert/ck.pem";
if (file_exists($certFullPath))
{
  /**
   * Payload vorbereiten
   */
  $message = 'PASSDROP UPDATE'; 
  $body = array();
  $body['aps'] = array('alert' =>  $message);


  /**
   * Host bestimmen
   */
  $apnsHost = "gateway.push.apple.com";   // Development Umgbung

  /**
   * Stream erstellen
   */
  $ctx = stream_context_create();
  stream_context_set_option($ctx, 'ssl', 'local_cert', $certFullPath);
  $fp = stream_socket_client('ssl://' . $apnsHost . ':2195', $err, $errstr, 2, STREAM_CLIENT_CONNECT, $ctx);
  if (!$fp) 
  {
    echo "Fehler beim APNS: " . $err . " / ". $errstr. "\n";
    return false;
  }

  /**
   * Payload versenden
   */
  $payload = json_encode($body);
  $msg = chr(0) . pack("n",32) . pack('H*', str_replace(' ', '', $this->token)) . pack("n",strlen($payload)) . $payload;      
}
else
{
  throw new Exception("Zertifikat-Bundle " . $certFullPath . " existiert nicht !!!");
}
}

据我所知Apple没有阅读有效载荷在Passbook中推送Pass。

As far as I know Apple does not read the payload when pushing a Pass in Passbook.

有人提示我接下来可以尝试什么吗?
我是否需要pass.json文件中的任何内容?

Does anybody have a hint for me what I can try next? Do I need anything in the pass.json file?

推荐答案

如果您的设备正在更新并接收新的通行证,但是你没有看到通知,那么你的pass.json很可能不包含changeMes​​sage键。

If your devices are updating and receiving the new passes, but you are not seeing a notification then it is most likely that your pass.json doesn't contain a changeMessage key.

为了显示通知:


  • 传递数据值必须已更改(字段标签,颜色和图像不会触发更新),

  • 更改后的字段必须包含changeMes​​sage键,最好使用%@占位符替换为新字段值。

对于Passbook,APNS推送的唯一目的是通知设备Web服务具有新鲜内容。所有通知活动都是由旧的和新的pass.json文件之间的差异决定的。

For Passbook, the APNS push's only purpose is to notify the device that the web service has fresh content. All notification activity is determined by the differences between the old and new pass.json files.

如果你的传递字段正在改变,你有一个changeMes​​sage键设置但你是没有看到通知,然后发布pass.json之前和之后的相关部分可以帮助我们识别出什么是错误的。

If your pass field is changing, and you have a changeMessage key set but you are not seeing a notification, then posting the relevant before and after sections of pass.json may help us identify what's wrong.

下面的json摘录将触发以下两个通知'after'传球取代'之前'传球:

The json excerpts below will trigger the follwoing two notifications when the 'after' pass replaces the 'before' pass:


  • 请继续进入22号门

  • 航班状态:登机

通行证前:

  "boardingPass": {
        "headerFields": [{
            "key": "h1",
            "value": "--",
            "label": "Gate",
            "changeMessage": "Please proceed to gate %@"
        }, {
            "key": "h2",
            "value": "On Time",
            "label": "Status",
            "changeMessage": "Flight status: %@"
        }],
           ...

通过后:

  "boardingPass": {
        "headerFields": [{
            "key": "h1",
            "value": "22",
            "label": "Gate",
            "changeMessage": "Please proceed to gate %@"
        }, {
            "key": "h2",
            "value": "Boarding",
            "label": "Status",
            "changeMessage": "Flight status: %@"
        }],
           ...

这篇关于Passbook Update Push未在锁屏上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆