问题
I have a pass installed. When installed on a device it registers to my server, the device id is also registered with Urban Airship services.
So far so good.
When I try to send a push message from the dashboard at urban airship, or curling, or let the server send the push, it is never received by the device. Is there anything special I have to think about when pushing passkit updates?
回答1:
After a lot of tinkering I got this to work. The solution is not intuitive:
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).
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.
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.
回答2:
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
来源:https://stackoverflow.com/questions/12623623/passkit-push-notifications-not-working-with-urban-airship