Serving a pkpass directly from backend #150
-
Hey @alexandercerutti, It's Saim again, hope you're doing well! In your comment on scriptpapi's YouTube video, I saw you mentioned that passes do not need to be saved to cloud storage or anything and can just be served as is. Would you be able to walk me through roughly how that works? I tried to look through the examples in this repo but I couldn't quite make sense of where I should look, I am an iOS developer primarily so would love a bit of help with this side of things :) Assuming I have the exact same backend featured in that video, if you could please point me in the right direction I would greatly appreciate it! Best wishes, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
Hey there, @Saim-Khan1! You can look at it this way: you are performing an HTTP Request and replying back with one or more chunks of data. Some of those chunks might be the file itself you are serving from the server. Response must have a You could grab that binary information, and set it to have a specific I could link you to an example swift app I did like 4 years ago, which takes an URL in and receives and adds the PKPass without the need of saving it first somewhere in the cloud. Of course, the app is not updated. There might be better ways to achieve things, but it might be good enough to let you see how it might go. Do not expect high-quality / enterprise-level code. I did only a bunch of months with Swift like 4 years ago. Here's the link: https://github.com/alexandercerutti/passkit-sample-client Let me know! |
Beta Was this translation helpful? Give feedback.
I don't have a code for that, but I guess you can use
response
parameter to set theContent-Type
header (note thatpasskit-generator
offers a.mimeType
property to be used, so you won't use the wrong one), set the status code and use.send()
and pass to it thegetAsBuffer
result.Somehow like you can see it here: https://firebase.google.com/docs/functions/http-events?hl=en&gen=2nd#terminate_http_functions