Passkit push notifications not working with Urban Airship

六眼飞鱼酱① 提交于 2019-12-05 12:32:06

After a lot of tinkering I got this to work. The solution is not intuitive:

  1. Make sure the 'application' you create on Urban Airship is pushing to Apple's production servers. Passbook will not recognize passbook pushes to the development server (You can only do this while creating your application - you can't modify it afterwards).

  2. Make sure you upload the certificate you use to sign your Pass IDs, NOT the one you use for standard push notifications. This is important because the certificate has the PassID embedded in it.

  3. Despite what Apple says, you need to include something in the payload. As far as I can tell, this is needed because Urban Airship will not push an empty payload. The contents of the payload doesn't matter. The device only cares that it gets something so it knows an update is needed. For example, this works (python):

    airship = urbanairship.Airship(_UrbanAirshipPassbookKey, _UrbanAirshipPassbookMasterSecret) airship.push({'aps': {'alert': 'Go.'}}, device_tokens=tokens)

Urban Airship will hopefully change this in the future.

Figured it out when I got more control over the backend.

 Server response was malformed (Wrong type object for key lastUpdated in response dictionary. Expected NSString but found __NSCFNumber.)

So now it works with urban airship

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!