I have a string I read from a text file: text = String(contentsOfFile: path!, encoding: NSUTF8StringEncoding, error: nil)!
. Using println(text)
I get the output "some text".
Now I also have another string otherSting = "other text"
. What I want to do is save this text to the text file. I tried using otherText.writeToFile(path!, atomically: true, encoding: NSUTF8StringEncoding, error: nil)
and then reading the text file again. When trying on the iOS Simulator I get the output I expected: "other text". But when executing the same app on my iPhone i still get "some text". Does anybody know what I am doing wrong?
Edit:
I also tried using otherText.writeToURL(url!, atomically: true, encoding: NSUTF8StringEncoding, error: nil)
with the same results.
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire