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

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -

shared memory - gstreamer shmsrc and shmsink with h264 data -