this is my code and everything is ok ,after i take the data from server ,my code doesn't work for parsing part . the strange thing is it's working with some data and not working with another and i check my data ,i have data because i change my data to string with utf8encoding ,it's perfect but my parser steel doesn't work :((
func connection(connection: NSURLConnection!, didReceiveData data: NSData!){
var someString = NSString(data: data, encoding: NSUTF8StringEncoding)!
var someData = someString.dataUsingEncoding(NSUTF8StringEncoding)!
println(NSString(data:someData , encoding: NSUTF8StringEncoding)!)
let jsonObject : AnyObject? = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments , error: &jsonError )
and the error is :
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Unexpected end of file while parsing object.) UserInfo=0x7fba6ad5c690 {NSDebugDescription=Unexpected end of file while parsing object.}
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Garbage at end.) UserInfo=0x7fba6af7b690 {NSDebugDescription=Garbage at end.}