The problem is when there is incomplete data NSJSONSerialization.JSONObjectWithData is crashing the application giving unexpectedly found nil while unwrappin
NSJSONSerialization.JSONObjectWithData
unexpectedly found nil while unwrappin
Swift 3:
let jsonData = Data() do { guard let parsedResult = try JSONSerialization.jsonObject(with: jsonData, options: .allowFragments) as? NSDictionary else { return } print("Parsed Result: \(parsedResult)") } catch { print("Error: \(error.localizedDescription)") }