If you don not know whether it starts with dictionary or array you better to go through the Online JSON Viewer where you can paste your json response and identify the data.
If json starts with Dictionary(Dictioanry starts with {....} in json response),you need to use
if let jsonResponse: NSDictionary = NSJSONSerialization.JSONObjectWithData(ihelper.responseData!, options: NSJSONReadingOptions.AllowFragments, error: &error) as? NSDictionary
{
println("Response are(jsonResponse)")
}
If json starts with Array(Array starts with [....] in json response),you need to use
if let jsonResponse: NSArray = NSJSONSerialization.JSONObjectWithData(ihelper.responseData!, options: NSJSONReadingOptions.AllowFragments, error: &error) as? NSArray
{
println("Response are(jsonResponse)")
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…