Brotli compression is documented as available in iOS 13+. But my experience is that if I try to use Brotli compression prior to iOS 16 that my app will suffer a dload failure trying to dynamically link against the Compression library.
I have solved this, sort of, by weak linking against libCompression, and check that the IOS version >= 16 prior to using .brotli
Here's how I'm using brotli:
let outputFilter = try OutputFilter(.compress,
using: .brotli) { (data: Data?) -> Void in
if let data {
compressedData.append(data)
}
}
(The above will cause a dload error on iOS 15)
Questions:
- Is this a known issue?
- Is there any better way to test weather .brotli is available than checking the iOS version? I have somewhat anecdotal evidence that the OS version may no be the full story.