I'm trying to convert NSURL
to NSData
. My url string is a local file url which I'm getting from my device.
let url = NSURL(string: url)
let imageData = NSData(contentsOfURL: url)
let image = UIImage(data: imageData)
I'm getting NSURL
value properly. But while converting it to NSData
it gives nil
value. I know there are similar questions in stackoverflow but none of them solves my problem. I'm using swift 2.2