试图获得一个标签来显示从一些 JSON 中提取的数据......
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSError *myError = nil;
NSDictionary *res = [NSJSONSerialization JSONObjectWithData:jsonresponse options:NSJSONReadingMutableLeaves error:&myError];
NSArray *results = [res objectForKey:@"current_observation"];
NSArray *cur = [results valueForKey:@"weather"];
NSArray *tmp = [results valueForKey:@"temp_f"];
NSString * tmpstring = [[tmp valueForKey:@"description"] componentsJoinedByString:@""];
temp.text = tmpstring;
}
当它运行该代码时,它会吐出这个......
2013-01-31 15:38:03.319 Places[4659:907] -[__NSCFString componentsJoinedByString:]: unrecognized selector sent to instance 0x5680d0
2013-01-31 15:38:03.321 Places[4659:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString componentsJoinedByString:]: unrecognized selector sent to instance 0x5680d0'
*** First throw call stack:
(0x32b3e3e7 0x3a82f963 0x32b41f31 0x32b4064d 0x32a98208 0x413b 0x3347a915 0x333ba769 0x333ba685 0x3281b64f 0x3281ad33 0x32843013 0x32a84acd 0x32843473 0x327a7461 0x32b138f7 0x32b1315d 0x32b11f2f 0x32a8523d 0x32a850c9 0x3666333b 0x349a12b9 0x20c9 0x2050)
libc++abi.dylib: terminate called throwing an exception
(lldb)
有任何想法吗?