swift2 - createFileAtPath not accepting NSURL anymore -
let singleimage = "current.jpg" let path = nsurl(fileurlwithpath: nstemporarydirectory()).urlbyappendingpathcomponent(singleimage) let filemanager = nsfilemanager.defaultmanager() filemanager.createfileatpath(path, contents: imagedatafromurl, attributes: [:])
createfileatpath
stopped working after upgrade swift 2 , gives following error:
cannot convert value of type 'nsurl' expected argument type 'string'
unfortunately nsfilemanager
has no creation method operates on nsurl
. in code try avoid string
path usage , 1 of rare places still fall path using nsurl.path
property
filemanager.createfileatpath(pathurl.path!, contents: imagedatafromurl, attributes: [:])
Comments
Post a Comment