ios - 分发 Passkit 通行证

标签 ios server passkit

我目前正在阅读:https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/PassKit_PG/Updating.html#//apple_ref/doc/uid/TP40012195-CH5-SW1

它表示设备会注册通行证的推送通知,但这只会在通行证最初安装后发生(并且由 AppleWallet 自动发生)。

我的问题是,如何给用户初始定制通行证? 例如:用户打开我的应用程序,点击“将通行证添加到钱包”按钮。它应该在特定于该用户的服务器端生成一个通行证并安装它,还是应该有一个带有通用字段的本地通行证,安装它并且钱包会自动下载最新的通行证?

我问所有这些是因为在 Apple 的服务器引用(用 Ruby 编写)中,他们有:

  ################
  # 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.
  ###############

所以看起来你不应该将通行证下载到设备上而不是在注册电话中?还是我读错了?

最佳答案

如果您的服务器已经提供了 Pass 包,最好的方法是使用 PKPass(data:error:)其中 data 是在您自己的应用程序中下载的 Pass 文件。通过这种方式,您可以将其创建集中在一个地方,从而最大限度地减少可能的不匹配信息。

之后,您可以通过两种方式在设备上安装通行证:

关于ios - 分发 Passkit 通行证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42329105/

相关文章:

ios - 安全地访问 iOS 中的文件

html - 如果用户设备没有互联网连接,我希望我的网站显示一个特定的页面,通知他们他们处于离线状态

rest - 使用rest api以自动方式将大文件发送到服务器的最佳方法?

ios - 应用程序在 App Store 中显示 "support wallet",即使钱包功能已关闭

ios - 如何使用 PKAddPassButton 为具有本地化的通行证创建 "Add to apple wallet"按钮

ios - 在 View 内的矩形内绘制简单的线性渐变

ios - 我需要创建一个Facebook应用程序才能使用Facebook登录吗?

ios - UICollectionCell 调用 CollectionViewController 中的方法

javascript - 如何在特定时间跨度内进行具有速率限制的异步 API 调用?

swift4 - 无法从服务器下载 PKpass