Brandon
Brandon

Reputation: 23498

Distributing Passkit Passes

I am currently reading: https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/PassKit_PG/Updating.html#//apple_ref/doc/uid/TP40012195-CH5-SW1

It says the device registers for push notifications for passes, but this only happens AFTER the pass has been initially installed (and it happens automatically by AppleWallet).

My question is, how can I give the user the initial customized pass? For example: User opens my app, hits "Add Pass to Wallet" button. Should it generate a pass on the server-side specific to that user and install it OR should it have a local pass with generic fields, install that and wallet will automatically download the latest pass?

I am asking all of this because in Apple's server reference (written in Ruby), they have:

  ################
  # FOR DEVELOPMENT PURPOSES ONLY
  # This endpoint is to allow developers to download a pass.
  # 
  # NOTE: This endpoint is not part of the offical API and does not implement
  # authentication/authorization controls and should only be used for development.
  # Please protect your user's data.
  #

  get "/pass.pkpass" do
    redirect "/sample.pkpass"
  end

  get "/:serial_number.pkpass" do
    # Retrieve pass file
    pass_output_path = File.dirname(File.expand_path(__FILE__)) + "/data/passes/#{params[:serial_number]}.pkpass"

    # Send the pass file
    send_file(pass_output_path, :type => :pkpass)
  end

  ###
  # End of development only endpoint.
  ###############

so it seems as though you shouldn't download passes onto the device other than in the registration call? or am I reading it wrong?

Upvotes: 0

Views: 717

Answers (1)

Igor Camilo
Igor Camilo

Reputation: 1200

If your server already provides Pass packages, the best way of doing this is with PKPass(data:error:) where data is the Pass file downloaded inside your own app. This way, you centralize its creation in only one place, minimizing possible mismatched information.

After that, you can install the Passes on the device with two methods:

Upvotes: 1

Related Questions