J'ai créé un service WCF, qui fournit la réponse suivante à mon opération POST:NSJSONSerialization données de réponse parsing
"[{\"Id\":1,\"Name\":\"Michael\"},{\"Id\":2,\"Name\":\"John\"}]"
Mon appel à JSONObjectWithData, ne renvoie pas d'erreur, mais je ne peux pas énumérer sur la résultats, qu'est-ce que je fais mal?
NSError *jsonParsingError = nil;
NSMutableArray *jsonArray = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers|NSJSONReadingAllowFragments error:&jsonParsingError];
NSLog(@"jsonList: %@", jsonArray);
if(!jsonArray)
{
NSLog(@"Error parsing JSON:%@", jsonParsingError);
}
else
{
// Exception thrown here.
for(NSDictionary *item in jsonArray)
{
NSLog(@"%@", item);
}
}
Quel type d'exception est levée? –
Est-ce que votre NSLog génère quelque chose à partir de jsonArray? – Jeremy
@ Jacob-Relkin - L'exception est: EXC_BAD_INSTRUCTION – mservidio