Exactly as explained here, https://stackoverflow.com/a/30624755/294884
[It is a mistake to think that] the JPEG representation of an image is a UTF-8-encoded
This line has a problem:
let mystere = trueBinary.count.base64EncodedString(
options: .lineLength76Characters)
The problem is that trueBinary is a Data, and trueBinary.count is an Int, and Int doesn't have a base64EncodedString method. You want this:
let mystere = trueBinary.base64EncodedString(
options: .lineLength76Characters)
As for ‘the "lineLength" concept’: you don't have to specify a line length option if you don't want to. Arguably I shouldn't have specified one in the answer you referenced in your question, because HTTP requests are not strictly MIME messages and are not subject to the MIME line length limit. You can do this instead:
let mystere = trueBinary.base64EncodedString()