我的应用程序在Instagram上共享照片,为此,首先将其保存在一个临时目录中:
let writePath = NSTemporaryDirectory().stringByAppendingPathComponent("instagram.igo")
它正在工作Swift 1.2,但不起作用Swift 2.0。
Swift 1.2
Swift 2.0
给定的错误消息是:
stringByAppendingPathComponent不可用:在NSURL上使用URLByAppendingPathComponent。
看来该方法stringByAppendingPathComponent已在Swift 2.0中删除,因此错误消息建议使用:
stringByAppendingPathComponent
let writePath = NSURL(fileURLWithPath: NSTemporaryDirectory()).URLByAppendingPathComponent("instagram.igo")
更新:
URLByAppendingPathComponent()已被替换为appendingPathComponent():
URLByAppendingPathComponent()
appendingPathComponent()
let writePath = NSURL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("instagram.igo")