0
請考慮下面的代碼:如何在客觀C顯示在UITextView的JSON結果數據
NSString *jsonreturn = [[NSString alloc] initWithContentsOfURL:[ NSURL URLWithString:url ]]; // Pulls the URL
NSLog(@"jsonreturn#########=%@",jsonreturn); // Look at the console and you can see what the restults are
NSData *jsonData = [jsonreturn dataUsingEncoding:NSUTF32BigEndianStringEncoding];
CJSONDeserializer *theDeserializer = [CJSONDeserializer deserializer];
theDeserializer.nullObject = NULL;
NSError *error = nil;
NSDictionary *dictt = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];
NSLog(@"###dict=%@", dictt);
if (dictt) {
rowsForQuestion = [[dictt objectForKey:@"faqdetails"] retain];// NSArray rowsForQuestion
}
[jsonreturn release];
//我有這個數據是在控制檯現在我想打印的UITextView,但我怎麼能做到這一點
faqdetails = (
{
faqAns = "Yes, Jack Kalis is the best crickter";
faqQues = "who is the best cricketer in present year?";
}
);
}