Passbook notification failing - ios6

Followed the intermediate Passbook tutorial from the book "iOS 6 by tutorials"
http://www.raywenderlich.com/store/ios-6-by-tutorials
I'm able to send a pass by email, add it to pass book, update it in my app and it updates when I open passbook but I'm not getting any notification. Notifications are turned on in the settings.
My guess is that it could be the firewall of my server. I'm new to the howl server setup. I'm running on a godaddy vps (centos).
When I run a list on iptables I get the following:
iptables -L -vn
Does this look right ?
Any clue appreciated !
Thanks

This is unlikely due to a firewall issue on the server side - but could possibly be an issue with the firewall of the router that your device is connected to. Apple delivers push notifications to devices on port 5223, so this needs to be open on your local router (assuming you are connected by wifi). If you can receive push notifications from other Apps (WhatsApp, Facebook, etc.) then you can rule out firewall as an issue.
You state that the pass does get updated - this implies that either a push is being received by Apple and is triggering the device to retrieve the new pass from your web service, or if you are using replacePassWithPass to update the pass via an App, this is functioning as expected.
In order for the pass to display a notification message:
A pass data field must have changed (changing pass types, colours, images or label values will not trigger a notification), and
The field must have the changeMessage key set (ideally the changeMessage contains %# which will be replaced by the new field value)
If the above two criteria are met and you are still not receiving a notification, then try hooking your device up to Xcode and watching the console log as you update a pass.

Related

Auto update feature in passbook ios 7

How does automatic updates work in passbook available in backfield of the pass, how to use webserviceURL key to get update from the server.
in webserviceURL key i have provided remote path from where updated pass can be downloaded, but even after content changed in server, it does not reflects in pass.
This question has been asked so many times, in so many ways, in so many forums; mostly by people that are too lazy to read the manual, or are too inexperienced / incompetent to understand it.
The first paragraph of the Passbook Web Service Reference explains why simply adding a link to an updated pass will not work.
A REST-style web service protocol is used to communicate with your server about changes to passes, and to fetch the latest version of a pass when it has changed. The endpoints always begin with the web service URL, as specified in the pass, followed by the protocol version number. For example, a request for the latest version of the pass of type com.apple.pass.example and serial number ABC123 might look like the following:
The Passbook web service is an integral part of the Passbook eco system. Anyone wishing to issue passes that change their content (either in response to a push message or in response to a user requesting fresh content by pulling down on the back of the pass), needs to implement their own Passbook web service.
This entails building a server capable of responding to the following to authenticated requests from each device that has installed your pass.
There are 5 methods that your web service should respond to:
1. Registering a Device to Receive Push Notifications for a Pass
POST request to https://webServiceURL/v1/devices/deviceLibraryIdentifier/registrations/passTypeIdentifier/serialNumber
2. Getting the Serial Numbers for Passes Associated with a Device
GET request to https://webServiceURL/v1/devices/deviceLibraryIdentifier/registrations/passTypeIdentifier?passesUpdatedSince=tag
3. Getting the Latest Version of a Pass
GET request to https://webServiceURL/v1/passes/passTypeIdentifier/serialNumber
4. Unregistering a Device
DELETE request to https://webServiceURL/v1/devices/deviceLibraryIdentifier/registrations/passTypeIdentifier/serialNumber
5. Logging Errors
POST request to https://webServiceURL/v1/log
In order to have a pass respond to a manual refresh or push request you need to implement at least the first 3 methods. This is because the device will not issue any further requests until it has received a valid response to the registration request.
Furthermore, the web service must be available over https. An unsecured http service can be used for development, but production devices will only recognise a webServiceURL key that begins with https.

What is the proper way of updating subscriptions to the Glass timline when the IP of the target host changes?

Here's a situation that occurred to my team:
we inserted a Mirror API subscription with a CallbackUrl under a domain we control (the corresponding A record pointed to, say, IP1)
we verified we could receive Mirror API notifications from Glass devices
we changed the A record of our domain to point to a new host with a different IP address (let's call it IP2).
even after propagation of the updated A record, the Mirror API kept sending the notification to IP1 rather than IP2
Is the IP of the host associated with the callback URL cached by the Mirror API ?
Then, we tried the following:
we deleted the subscription and created a new one. The notifications kept going to IP1
we uninstalled and re-installed the Glassware, did a new Oauth authorization, etc.
We verified that on listing the active subscriptions,
they looked "fresh", with a recent "updated" timestamp.
However, notifications are go to the old IP address IP1.
Any ideas on what may be going on, and how to overcome this issue?
Thanks in advance!
Also submitted to issue tracker: https://code.google.com/p/google-glass-api/issues/detail?id=36&colspec=ID%20Type%20Status%20Priority%20Owner%20Summary

How to call pushnotification when server want to update pass

I have an interface for updating pass. When I click 'update pass', I want to call pushnotification to the pass in device. I don't know how to do this. How to do this?
For Passbook, quite a few things have to be in place in order for a push to trigger a notification on a device. From your form, you will need to implement everything to follow this flow:
post the data from your form to your server and update the pass record(s) in your database
retrieve the device pushToken(s) for the device(s) that require the updated pass from your devices table (these should be linked to the pass table with a common key)
connect to the production APNS using the PassID certificate that matches the passTypeIdentifier of the changed pass
send an APNS message containing an empty payload for each device
wait a few seconds......
upon receiving the push, each device will contact your web service using the 'Getting the Serial Numbers for Passes Associated with a Device' method
your web service must respond with a json dictionary containing the serial(s) of the updated pass (note only send serials relevant to the device, if you send a serial of a pass that is not installed, you will receive error log messages)
when the device get's your response, it will call your service again with the 'Getting Latest Version of a Pass' for the serial you sent it.
dynamically build the new .pkpass bundle and send as a response with the correct MIME type and 'Last-Modified' header
providing that a field value has changed, and that field dictionary contains a changeMessage key, a notification will show on the device. If nothing has changed, or if no changeMessage is set, the above will still happen, the pass will update but you will not see a notification.

How to make a push notification for a pass

I made a pass web service already. Next, I need to make a push notification when my pass is updated. From Updating a pass of passkit programming guide, it is not in detail. Can you explain this in detail ?
The requirements and protocol for push notifications is documented in the Push Notification Programming Guide.
There are a few special considerations for Passbook:
All Pass push requests must be sent to the production APNS server (gateway.push.apple.com on port 2195)
You must use your Pass Type ID certificate and key to authenticate with the APNS server (do not use App APNS certificates)
There is no need to handle device registrations, you simply use the pushToken that your web service received when the device registered the pass
The payload should be an empty - E.g. {"aps":""}
alert, badge, sound and custom property keys are all ignored - the push's only purpose is to notify Passbook that your web service has a fresh pass. The notification text will be determined by the changeMessage key in pass.json and the differences between the old and the new .pkpass bundles
ThechangeMessage string should contain %# if you wish for the content of the value key to be displayed. Change messages may have static text in addition to the %# variable, such as this: "changeMessage":"New updates: %#". If no %# is provided, a generic message with the kind of pass is displayed: "Store card changed".
As of iOS9, if you modify more than one field at a time, only one generic message will be displayed on the lock screen.
You still need to regularly query the feedback service and purge expired/invalid pushTokens from your database
Note that push updates can be implemented independently of your web service. Apple provide some sample objective-c code in Listing 5-1 here.

What is the alternative way of sending user location via sms on iOS6?

i have done a security app which locate a iPhone and send the GPS location of the phone through message to an associated number this functions works good until iOS 5, but the issue is sending SMS without users knowledge is restricted in iOS 6, so i need a help here instead of sending message, is there any other possible way or replacement for this function? any answer related to this method are appreciated.
Thank you.
You haven't specified whether your ios app has a server. If yes, you can transmit location to server and that in turn can transmit it to intended user via specific api.
If this is not correct, APNS is your friend. This is a way to send messages to desired devices only, the ones who explicitly registers through your app.
Another quite equivalent option is to store it in public back-end like parse.com. As soon as other devices start your app, they can pull your location from there. If their device is already live, parse.com can make sure to notify them as soon as you change your location value in their DB.

Resources