嗯通常的Swift升级需要重写。我的古老路径命令不再起作用“stringByAppendingPathCompnent不可用”
return NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)[0].stringByAppendingPathComponent(fileName)
如果我按指示使用URLByAppendingComponent
return NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)[0].URLByAppendingPathComponent(fileName)
我被告知String类型的值没有成员URLByAppointmentPathComponent
我该如何解决这个问题?
答案 0 :(得分:1)
而不是你可以试试这个:
return try! NSFileManager().URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: true).URLByAppendingPathComponent(fileName).path!