Ich habe gerade Xcode 9 aktualisiert und meine App von 'swift 3' in 'swift 4' konvertiert und erhalte diese Fehler. Wie kann ich das beheben?Wert des Typs 'NSAttributedString.DocumentAttributeKey' kann nicht in den erwarteten Wörterbuchschlüsseltyp 'NSAttributedString.DocumentReadingOptionKey' konvertiert werden.
func displayText() {
do {
if url.pathExtension.lowercased() != "rtf" {
let fileContent = try String(contentsOf: url)
text.text = fileContent
} else { // Is RTF file
let attributedString = try NSAttributedString(url: url, options: [NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType], documentAttributes: nil)
text.attributedText = attributedString
text.isEditable = false
}
}
Und diesen Fehler
Wert kann nicht vom Typ 'NSAttributedString.DocumentAttributeKey' zu erwarten Wörterbuch Schlüsselart