I have the following few lines:
NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:&error];
if (error) {
NSLog(@"Error serializing %@", error);
}
NSLog(@"JSOND: %@", JSON);
NSString *valueFromKey = [JSON objectForKey:@"backseatBucks"];
NSLog(valueFromKey);
NSLog(valueFromKey.class);
The first NSLog will print:
JSOND: {
backseatBucks = 5;
}
However it seems to be erroring on the *valueFromKey
line because the following 2 print statements are not executed. The error is listed below- any help is appreciated:
2015-04-23 17:32:35.382 BackseatDriver2[3554:113938] JSOND: {
backseatBucks = 5;
}
2015-04-23 17:32:35.383 BackseatDriver2[3554:113938] -[__NSCFNumber length]: unrecognized selector sent to instance 0x7a64a810
2015-04-23 17:32:35.384 BackseatDriver2[3554:113938] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]:
unrecognized selector sent to instance 0x7a64a810'
Note: I have set symbolic breakpoints as suggested and am still thoroughly confused why I would be getting this error