Hi Rob, Thanks for your help. The error description is:
"The file couldn’t be opened because it isn’t in the correct format".
But the Data(ContentsOf) does seem to read the file and prints the total bytes.
It's a csv file, but it just uses a | instead of a comma as its delimiter, as there are commas in the text in the fields. I've been doing it this way for several years and had no problem with Xcode opening the files until my upgrade of MacOS and Xcode yesterday.
I've just tried compiling a couple of the previous versions of the app and those now all fail with the same error at the same point too, so I think there must be a change in the way MacOS or Xcode validates csv files?
The goal of this is simply to read the csv rows into an array:
csvArray = content.components(separatedBy: "\n") as [String]
and then iterate through each row and split into fields:
let csvFields = thisCsvRow.components(separatedBy: "|")
Any ideas how else I could do this?
Thanks. Andrew.
Topic:
Programming Languages
SubTopic:
Swift
Tags: