stringByExpandingTildeinPath不可用

时间:2015-09-17 16:21:07

标签: ios swift2

转换项目后,我在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

1 个答案:

答案 0 :(得分:3)

你为什么要求它不扩展addr然后自己花费?更简单的让API自己处理它:

addr