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

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -