Post

Replies

Boosts

Views

Activity

Reply to Opening file from main bundle in Xcode 16
Problem solved. In case anyone else has something similar, it looks like Xcode 16 has become more strict in verifying ascii files. The same ascii import has been running on the same text file in my app for years, but now it seems that if there's even a single non-ascii character it gives the "Can't open the file" error. Previously it would just strip out any non-ascii characters and continue to load the file. I got chatgpt to write me a clever little macro that checks for non-ascii characters in excel and highlights the cells they're in. Turns out there was an eclipse, a smart quote and a few invisible NBSP's which had been copied in from another source many years ago. Replacing those allowed the file to be read again.
Oct ’24
Reply to Opening file from main bundle in Xcode 16
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.
Oct ’24