vendredi 14 novembre 2014

Weird application document's directory being returned


Vote count:

0




So I have this:



private static func getSessionCookie() -> String? {
let documentsDirectory = applicationDocumentsDirectory()!.path!
let filePath = "\\" + documentsDirectory.stringByAppendingString(sessionCookieFileName)
var error: NSError?

return String(contentsOfFile: filePath, encoding: NSUTF8StringEncoding, error: &error)
}

private static func setSessionCookie(newSessionCookie: String) {
let documentsDirectory = applicationDocumentsDirectory()!.path!
let filePath = "\\" + documentsDirectory.stringByAppendingString(sessionCookieFileName)
var error: NSError?

newSessionCookie.writeToFile(filePath, atomically: true, encoding: NSUTF8StringEncoding, error: &error)
}


The setter works great, it gets the right documents directory and creates the right file path. Now the getter returns some weird value for the applicationDocumentsDirectory call: "\xd0\xb0K7".


What's going on? Am I doing something wrong?



asked 1 min ago







Weird application document's directory being returned

Aucun commentaire:

Enregistrer un commentaire