I'm using an API service of a web service and it is written in their description that they send JSON data wich also matches in my opinion with the response I get from it. Here a part of it which I got from the NSURLConnection-Delegate (connection didReceiveData: (NSData *) data) and converted in a NSString using:
NSLog(@"response: %@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
Here the snippet:
{"scans":
{
"Engine1“:
{
"detected": false,
"version": "1.3.0.4959",
"result": null,
"update": "20140521"
},
"Engine2“:
{
"detected": false,
"version": "12.0.250.0",
"result": null,
"update": "20140521"
},
...
},
"Engine13":
{
"detected": false,
"version": "9.178.12155",
"result":
In the NSLog-String it stops there. Now I would like to know from you whats wrong that I can't convert this data to a JSON Dictionary with this lines of code:
NSError* error;
NSMutableDictionary *dJSON = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
I experiment with some options but always the same error:
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)"
(Unexpected end of file while parsing object.) UserInfo=0x109260850 {NSDebugDescription=Unexpected end of file while parsing object.}
Everything indicates that the JSON packet is incomplete but I don't know how to check it or how to look for the issue which should be located in my code.