I’m using HTTP request for my iPhone App. When I want to made the dictionnary, there is a NSException…
[__NSCFDictionary objectAtIndex:]: unrecognized selector
Here’s the code for the connectionDidFinishLoading :
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
[connection release];
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"responseString");
NSLog(responseString);
[responseData release];
NSArray *tableau = [responseString JSONValue];
NSLog(@"the newt line give me the exception");
NSDictionary *dico = [tableau objectAtIndex:0];
responseString give me that:
{"token":"8569fe2e095d83a4692812fa808f84da"}
I used that code before but it want not run with those datas…
If you can help me, it would be very nice!
Thank You !
Arrays in JSON are delimited by
[], whilst objects/dictionaries are delimited by{}. Since your response isit is not an array — it’s a single object/dictionary.
Try: