-3

I am learner on iOS Development,today i try to code somethingenter image description here about FileManger,but this method return a type '()',how can i to resolve it?

the warning code as follow:

Jixes
  • 27
  • 6

1 Answers1

1

The problem is that your call to createDirectoryAtURL does not have a explicit return value. In Swift, that means it returns a Void which is represented by the empty tuple (). This is what your call should look like.

    let temp = NSTemporaryDirectory()
    let newDiretoryURL = NSURL.fileURLWithPath(temp + "/MyNewDirectory")
    try fileManager.createDirectoryAtURL(newDiretoryURL, withIntermediateDirectories: false, attributes: nil)
    print("Success")
  }
} catch {
  // handle errors here
}
Price Ringo
  • 3,424
  • 1
  • 19
  • 33