7 Replies
      Latest reply on Nov 22, 2017 1:08 PM by DmitryKanunnikoff
      p.knausst Level 1 Level 1 (0 points)

        Hello, I'm trying to save some Strings in a csv document:

                var tempString = String()
                for Rezept in alleRezepte {
                    tempString += "\(Rezept.name), \(Rezept.description), \(Rezept.nutrients), \(Rezept.whatToDo)\n"
                let dirs = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .allDomainsMask, true) as? [String])
                let path = dirs?[0].appending("rezepte.csv")
                let url = URL(string: path!)
                do {
                    try tempString.write(to: url!, atomically: true, encoding: String.Encoding.utf8)
                } catch {
                print("Daten gesichert")


        And I get this error:

        CFURLCopyResourcePropertyForKey failed because it was passed an URL which has no scheme

        Error Domain=NSCocoaErrorDomain Code=518 "The file couldn’t be saved because the specified URL type isn’t supported."


        How can I fix this?


        Thank you for helping.