0

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

Xcode error

I tried a lot of tutorials about swift 2 but didn't work

1

1 Answer 1

1

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)
} 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.