Error: use of unresolved identifier for NSDocumentDirectory, NSUserDomainMask,
Error: use of unresolved identifier for NSDocumentDirectory, NSUserDomainMask,
我有一行代码:
var path: NSArray = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, true)
Xcode 抛出编译时错误:
use of unresolved identifier : NSDocumentDirectory, NSUserDomainMask
我不知道出了什么问题。
这样试试:
var path: NSArray= NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
let documentsUrl = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first as NSURL
if let documentsPath = documentsUrl.path {
println(documentsPath)
}
let paths = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
let documentsURL = paths[0] as NSURL
我有一行代码:
var path: NSArray = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, true)
Xcode 抛出编译时错误:
use of unresolved identifier : NSDocumentDirectory, NSUserDomainMask
我不知道出了什么问题。
这样试试:
var path: NSArray= NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
let documentsUrl = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first as NSURL
if let documentsPath = documentsUrl.path {
println(documentsPath)
}
let paths = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
let documentsURL = paths[0] as NSURL