Reputation: 201
this code was function correctly but when i tried on swift 2, i start having this errors, does anyone know how to fix them? i already add the NSAppTransportSecurity to info list. The app may be able to download a json array with images from server, but i'm not really sure how to do it on swift 2
I tried a lot of tutorials about swift 2 but didn't work
Upvotes: 0
Views: 124
Reputation: 22374
Try this....Use do catch instead of if let
do {
let jsonResult = try NSJSONSerialization.JSONObjectWithData(dataObject, options:.MutableContainers) as? NSArray
self.images = jsonResult
} catch let error as NSError {
print(error)
}
Upvotes: 1