I create an array in swift like so:
var imagesArray = [String]()
and I add some base64 images to that array like so:
imagesArray.append(imageBase64String!)
Now I need to create a text.txt file and write the imagesArray into that file so I can send it to the server.
I tried this:
let fileName = "myFile.txt"
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(fileName)
let data = Data(imagesArray)
do {
try data.write(to: url, options: .atomic)
print(url)
} catch {
print(error)
}
But this produces this error:
No exact matches in call to initializer
which is infant of this code: let data = Data(imagesArray)
could someone please advice on this issue?