What I meant: on the same iPhone, I receive say 10 push notifications sent from our backend (which goes to Firebase, which sends notification through APNs), all with same structure with only difference being imageUrl.
It's entirely random how many will have download task succeed and attach downloaded image file to the UNMutableNotificationContent and how many downloads will fail with the said error.
Sometimes most succeed. Sometimes none. Often 2-3 are OK, the rest fail. I checked SSL, TLS, whatever I could think for the web servers where the files are located, that was all fine.
Today I fired up the debugger session for the PNSE process and re-run the notification that has just failed minutes ago only to see the download returns with URL and no error. When I do get the error in the debugger session, I don't see anything useful in the stack frame that could tell me where is the problem.
I also tried using URLSesssion instance with custom configuration, seem to behave the same.
extension URLSessionConfiguration {
static var preferred: URLSessionConfiguration {
let c = URLSessionConfiguration.default
c.allowsCellularAccess = true
c.httpCookieAcceptPolicy = .never
c.httpShouldSetCookies = false
c.httpAdditionalHeaders = [
"Accept-Charset": "utf-8",
"Accept-Encoding": "gzip, deflate",
]
c.requestCachePolicy = .returnCacheDataElseLoad
return c
}
}
No idea what else to try...