drn9573 2012-10-08 18:12
浏览 50
已采纳

使用Passbook API发送推送通知

I'm trying to send some push notifications with the Passbook API. I've created the following JSON object that I send to the APNS server:

$payload = json_encode(array('aps' => array('alert' => 'Hello World!')));

However, this message does not arrive. I've been searching on internet on how to do this when using Passbook, but I can't find it. When I send an empty payload like this:

$payload = json_encode(new ArrayObject());

the (update) notification arrives and the pass gets updated.

So, does anyone know how I should send a custom message to the APNS server?

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • douqiao3930 2012-10-12 14:45
    关注

    Passbook specifically ignores the payload of the push notification. It ignores it on purpose so changes don't get missed if push notifications are missed.

    Passbook uses the notification simply as a signal to tell it to update the pass with the PassIdentifier contained in the cert that the push notification is signed with.

    Once it receives a notification (again, regardless of payload) it just sends a GET request to the webserviceURL for the pass associated with the DeviceID and the serialNumber. It also adds a query parameter passesUpdatedSince if it previously requested an update. If this is the first time it is requesting an update that query parameter won't be present.

    So, in summary, you are actually not supposed to send custom JSON payloads to Passbook passes through push notifications, in contrast to classic push notifications where you are talking to your own app.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 uniapp连接阿里云无法发布消息和订阅
  • ¥25 麦当劳点餐系统代码纠错
  • ¥15 轮班监督委员会问题。
  • ¥15 基于作物生长模型下,有限水资源的最大化粮食产量的资源优化模型建立
  • ¥20 关于变压器的具体案例分析
  • ¥15 生成的QRCode圖片加上下載按鈕
  • ¥15 板材切割优化算法,数学建模,python,lingo
  • ¥15 科来模拟ARP欺骗困惑求解
  • ¥100 iOS开发关于快捷指令截屏后如何将截屏(或从截屏中提取出的文本)回传给本应用并打开指定页面
  • ¥15 unity连接Sqlserver