https://developer.apple.com/documentation/cloudkitjs/cloudkit/database/1628735-saverecords mentions that we can use the downloadURL to provide a link to the user, however it seems this URL will expire after some time, and it will return 410 GONE as http status code when it expires.
How long does the link persist before it expires, is it documented anywhere?
Thanks for your question.
downloadURL
lasts for about an hour. If you want to know the exact expiration of the URL, you can look at the e=
query parameter in the downloadURL
itself. It's a UNIX epoch date in seconds. So in JavaScript, you could see the human readable date by creating a Date
object with that numeric value. For example, const exp = new Date(TheEValue)
. However, this is an implementation detail that you cannot rely on and I would not suggest you take that approach.
There is no way to adjust the time-to-live of the URL. If you want something longer lasting, you'll have to provide a solution yourself. If you'd prefer not to do that, then you'll have to gracefully handle any errors as a result of accessing that URL.