Error Domain = NSCocoaErrorDomain Code=3840 "Der Vorgang konnte nicht abgeschlossen werden. (Kakao Fehler 3840.)

Ich bin anfordern von dynamischen json-string von web-url.

-(void)getDataFromServer{

 NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://www.domain.com/json/"]];

[request setHTTPMethod:@"GET"];
[request addValue:@"getValues" forHTTPHeaderField:@"METHOD"]; 

NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
}



-(void)requestReturnedData:(NSData *)data{ //activated when data is returned

 NSDictionary *dictionary = [NSDictionary dictionaryWithJSONData:data];

}

Bekam ich folgende Fehlermeldung.

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=0x977a900 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

Habe ich getestet mit json-text-Datei

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://www.domain.com/jsonfile.json"]];

Funktioniert es perfekt. Wie kann ich das umgehen dieses Problem.

Bearbeiten---

Habe ich festgestellt, dass , wenn die Anzahl der Zeilen im json-überschreitung 200 dieser Fehler passiert. Sonst läuft er einwandfrei. ist es ein Problem mit der Größe der Daten.

stackoverflow.com/questions/14171111/...
Was macht Ihr JSON Aussehen? Sie wahrscheinlich erhalten einen string zurück oder die top-level-Objekt ist ein array.
Top-level-Objekt ist ein array.

InformationsquelleAutor Susitha | 2014-04-18

Schreibe einen Kommentar