Im trying to simply get a jpeg image from an url but when using NSData with contentsOfUrl is returning nil.
let aString = "http://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-xfp1/t31.0-8/q88/s720x720/10848858_907722502601079_2834541930671169073_o.jpg"
let url = NSURL(fileURLWithPath: aString)
let data = NSData(contentsOfURL: url!)
Any ideas?
You are trying to load a remote file with fileURLWithPath
which points to a system path.
What you are trying to achieve, can be done like this:
let aString = "http://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-xfp1/t31.0-8/q88/s720x720/10848858_907722502601079_2834541930671169073_o.jpg"
let url = NSURL(string: aString)
let data = NSData(contentsOfURL: url!)