通过NSFileManager获取document路径
let fileManager = FileManager.default
let urls = fileManager.urls(for: .documentDirectory, in: .userDomainMask)
if let documentPath = urls.first
{
let dbPath = documentPath.appendingPathComponent("xxx.db")
do
{
if try dbPath.checkResourceIsReachable()
{
}
}
catch
{
}
}
网友评论