0

Is it possible to preprogram passbook passes into my application and then they activate when the user enteres a specific geofence? So like when they enter the geofence a notification will come up on their phone and when they tap on it, it takes them to passbook where it adds the pass. Language- Swift Xcode 6.3

Junaid
  • 321
  • 1
  • 4
  • 15

1 Answers1

1

Short answer, yes it is possible.

Use CoreLocation to trigger a local push notification on entry to the geofence, and then in response to the local push present the pass using the PKAddPassesViewController. To cope with more than 20 locations, you can have your app poll your server on significant location changes and download the 20 closest locations.

PassKit
  • 12,231
  • 5
  • 57
  • 75
  • Thanks, I'm using Parse as my backend server. How would I ask it to download another 20 locations based on a significant location change? Could you write some sample code? (I'm a bit new to having my all connected to a server) – Junaid Jun 16 '15 at 22:03
  • There are plenty of examples of how to retrieve the nearest locations from a given set of lat/long coordinates. http://stackoverflow.com/questions/14254641/mysql-query-select-nearest-places-by-a-given-coordinates, as well as code for responding to significant location changes. http://stackoverflow.com/questions/24062509/location-services-not-working-in-ios-8. You will need to use a combination of the above and incorporate the output into a new pass bundle which you then will need to push to the device. – PassKit Jun 16 '15 at 22:34