How to make a directory iOS?

前端 未结 5 522
萌比男神i
萌比男神i 2020-12-14 16:23

Okay,

So I have a Cydia app that I need to update. I am aware with Cydia apps that they don\'t have a Documents folder, so you have to make one. And here\'s how I ma

5条回答
  •  离开以前
    2020-12-14 17:05

    In Swift, returns true if exists or created.

    func ensureDirectoryExists(path:String) -> Bool {
    
        if !NSFileManager.defaultManager().fileExistsAtPath(path) {
            do {
                try NSFileManager.defaultManager().createDirectoryAtPath(path, withIntermediateDirectories: true, attributes: nil)
            } catch {
                print(error)
                return false
            }
        }
        return true
    }
    

提交回复
热议问题