我目前正在阅读:ref/doc/uid/TP40012195-CH5-SW1
它说,设备注册推送通知的通行证,但这只发生在pass已初步安装(它自动发生由AppleWallet)。
我的问题是,我如何才能给用户最初的定制通行证?例如:用户打开我的应用程序,点击"Add Pass to Wallet“按钮。它是在服务器端生成一个特定于该用户的通行证并安装它,还是应该有一个带有通用字段的本地pass,安装它,钱包就会自动下载最新的pass?
我之所以这么问,是因为在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.
###############因此,似乎您不应该下载传递到设备上,而不是在注册电话?还是我看错了?
发布于 2017-02-19 20:29:40
如果您的服务器已经提供了Pass包,最好的方法是使用PKPass(data:error:),其中data是在您自己的应用程序中下载的Pass文件。这样,您只将其创建集中在一个地方,从而将可能出现的错误信息降至最低。
之后,您可以使用两种方法安装设备上的传递:
PKAddPassesViewController(passes:),或PKPassLibrary.addPasses(_:withCompletionHandler:)。https://stackoverflow.com/questions/42329105
复制相似问题