-2

I am trying to create a directory in my OS X app. The method was suggested as I started typing. But the method seems to be incorrectly suggested. The attributes parameter of the method in NSFileManger normally takes a [FileAttributeKey:Any] dictionary, but here in the suggestion it takes a [String:Any] library.

I checked the NSFileManager APIs and I could not find any like this. Can anyone explain what is happening here?

incorrect method suggestion

Eric Aya
  • 68,765
  • 33
  • 165
  • 232
Aravind G S
  • 370
  • 2
  • 17
  • you have to use it like FileManager.default.create..... not directly like FileManager.create – Umar Farooque Nov 17 '17 at 12:09
  • @UmarFarooque .. i know.. fileManager used here is defined as **let fileManager = FileManager.default** – Aravind G S Nov 17 '17 at 12:10
  • Try to import mobile core service and then pass the keys into the attributes dictionary. – Umar Farooque Nov 17 '17 at 12:12
  • it is probably the _placeholder_ in the signature has not been updated correctly yet, you still need to pass `[FileAttributeKey:Any]?` as attribute. – holex Nov 17 '17 at 12:17
  • @holex .. I tried passing [FileAttributeKey:Any]?. But got the following error _Cannot convert value of type '[FileAttributeKey : Date]' to expected argument type '[String : Any]?'_ – Aravind G S Nov 17 '17 at 12:20

1 Answers1

1

Your deployment target or your Xcode version is old. FileAttributeKey is new.

https://developer.apple.com/documentation/foundation/fileattributekey

matt
  • 447,615
  • 74
  • 748
  • 977