mardi 31 mars 2015

func return does notReturn String from my conform to protocol StringLiteralConvertible error

I have class which has the func of return path to some file:



func getArchivePathFor(fileName: String!) -> String {
var paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String
var path: String = paths.stringByAppendingPathComponent(fileName!)
return path
}


But when I try to use it in my code like:



let val = Helpers.getArchivePathFor("MyList.plist")


I get the error: "Return String from my func return does not conform to protocol StringLiteralConvertible error". Why so?


Aucun commentaire:

Enregistrer un commentaire