Jake Jake - 1 year ago 93
Swift Question

FileManager.urls returning error

I recently converted my project to Swift 3 and for the most part, it seems okay. However, I receive an error related to FileManager that says:
"Use of instance member 'urls' on type 'FileManager'; did you mean to use a value of type 'FileManager' instead?"

This error makes no sense to me. Here is a picture

static let DocumentsDirectory = FileManager.urls(for: .DocumentDirectory, in: .userDomainMask).first!

Answer Source

You need to call the urls method on an instance of FileManager, not on the class itself.

Change it to:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download