[英]Updating Apple Wallet .pkpass file stored in Cloud Storage from Firebase Cloud Functions to device
我正在尝试更新钱包中的通行证,我只需要最后一步:
在 Apples 文档中,它说:
“您的服务器返回 pass 数据或 HTTP 状态 304 Not Modified 如果 pass 没有更改。支持此端点上的 If-Modified-Since 缓存机制。”
functions.https.onRequest((request, response) => {
首先,我不知道应该如何发送数据
let file = bucket.file('Event.pkpass');
file.createReadStream()
.on('error', function(err) {
console.log("file get Error", err);
})
.on('response', function(resp) {
// Server connected and responded with the specified status and headers.
console.log("file get response", resp);
})
.on('end', function() {
console.log("File is downloaded");
// The file is fully downloaded.
})
.pipe(response);
我的问题是,该设备到底期望什么? 这个pkpass应该怎么发送? 我不是 Nodejs 程序员(iOS 程序员),所以请耐心等待。
let file = bucket.file('Event_1.pkpass');
file.createReadStream()
.on('error', function(err) {
console.log("File get Error", err);
response.status(501).send();
})
.on('response', function(resp) {
console.log("File get response", resp);
})
.on('end', function() {
console.log("File is downloaded");
response.status(200).send();
})
.pipe(response);
我自己想出来的。 还要记得为 Content-Type 设置正确的 header
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.