ios - NSURL to NSData nil value -


i'm trying convert nsurl nsdata. url string local file url i'm getting device.

    let url = nsurl(string: url)     let imagedata = nsdata(contentsofurl: url)     let image = uiimage(data: imagedata) 

i'm getting nsurl value properly. while converting nsdata gives nil value. know there similar questions in stackoverflow none of them solves problem. i'm using swift 2.2

if string points local file url using wrong api. correct 1 is

let url = nsurl(fileurlwithpath: urlstring) 

nsurl(string: url strings start valid file scheme (e.g. http or ftp)


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -