Swift 2 iOS 9 Do Catch Try crashing with unexpected nil found
问题 I'm trying to become familiar with the new do catch statements with swift 2 and iOS 9 My problem is that when an error occurs with NSURLSession, the data parameter returns nil, and error returns something. In iOS 8 this was expected functionality and we simply used if statements to find out whether or not Data was nil However with do catch , there is the new try keyword which I thought was meant to see if something works, if it doesn't then default to whatever code is written in catch However