转换项目后,我在Swift 2中收到以下错误:
stringByExpandingTildeinPath is unavailable: use stringByExpandingTildeinPath on NSString instead
这是我用来与Swift 1.2中的whatsapp共享的代码,第3行的错误:
let filename = "myimage.wai"
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, false)[0] as NSString
let destinationPath = documentsPath.stringByAppendingString("/" + filename).stringByExpandingTildeInPath
答案 0 :(得分:3)
你为什么要求它不扩展addr
然后自己花费?更简单的让API自己处理它:
addr