例如这种系统的方法。后面带着throws的如何实现它;
public func createDirectoryAtPath(path: String, withIntermediateDirectories createIntermediates: Bool, attributes: [String : AnyObject]?) throws
//实现它
do {
try FM.createDirectoryAtPath(cachePath, withIntermediateDirectories: true, attributes: nil)
} catch let error as NSError{
print("存储路径错误-->\(error)")
}
本文介绍了一个使用Swift语言创建目录的示例代码,并展示了如何通过do-try-catch语句块来处理可能出现的错误情况。
152

被折叠的 条评论
为什么被折叠?



