Reputation: 6608
I got a small problem that i really dont understand, if i try get the content from stackoverflow it works but if i replace it with for example google it does not work.
The app simply crashes on that task.resume()
var url = NSURL(string:"http://www.stackoverflow.com") // <-google.com does not work
let task = NSURLSession.sharedSession().dataTaskWithURL(url){(data, response, error) in
println(data)
println(NSString(data: data, encoding: NSUTF8StringEncoding))
}
task.resume()
}
Upvotes: 1
Views: 332
Reputation: 3628
Try to use other encoding like NSASCIIStringEncoding (google.com page contains some pure js functions, so I assume it will crash with NSUTF8StringEncoding) ? :D
Upvotes: 1