4

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?

Erik
  • 5,791
  • 5
  • 30
  • 45
  • Do you see anything in the console of the device? I've found that sometimes the push messages are rejected, so it's worth seeing if the push is received and that it's reaching out for an update to your passbook service. – Tomas McGuinness Sep 27 '12 at 14:25
  • No output regarding the push unfortunately :( – Erik Sep 27 '12 at 14:32
  • Do standard push messages work to other applications on the device? Have you get feedback from AirShip that indicates your push was accepted? I've found that sometimes you need the advanced API to give you result code when dealing directly with Apple's push gateway. I don't know if AirShip use that. – Tomas McGuinness Sep 27 '12 at 14:35
  • Yes I frequently get push messages for real apps. What does the advance API look like? – Erik Sep 27 '12 at 14:39
  • When you invoke messages directly through Apple's gateway, you can send an "advanced packet" and that will respond with a code. Useful for finding issues in the JSON packet etc, but probably hidden from you by UA. – Tomas McGuinness Sep 27 '12 at 14:41
  • I was hoping I could use UA, but might not be an option. Will try to debug trough telnet. – Erik Sep 27 '12 at 14:42
  • Take a look at http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW4. The section you should check is "enhanced notification format". That will give you feedback – Tomas McGuinness Sep 27 '12 at 17:43

2 Answers2

3

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.

Shaun Budhram
  • 3,690
  • 4
  • 30
  • 41
0

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

Erik
  • 5,791
  • 5
  • 30
  • 45