when I integrated the restful api it returns error
Optional(Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x17046c680 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.})
Can you please tell me why this happens? I coded in swift. Please check following line of code:
var jsonResponse = NSJSONSerialization.JSONObjectWithData(ihelper.responseData!, options: NSJSONReadingOptions.AllowFragments, error: &error) as AnyObject? as? NSArray
See Question&Answers more detail:os