와 구문 분석 : http://tempered.mobi/sites/default/files/JSonArticle.zip데이터는 내가이 예제를 사용하고 JSON 터치
그러나 시간 구문 분석에서 null 값을 보여줍니다.
내 PHP 코드 출력 :
{"news":[{"title":"DurianFM Android Application"},{"title":"Hari Raya"},{"title":"C"}]}
아이폰 코드 : 나는 DICT 변수을 확인할 때
(void)viewDidLoad {
[super viewDidLoad];
NSURL *url = [NSURL URLWithString:@"http://...........jsontest.php"];
NSString *jsonreturn = [[NSString alloc] initWithContentsOfURL:url];
NSLog(jsonreturn); // Look at the console and you can see what the restults are
NSData *jsonData = [jsonreturn dataUsingEncoding:NSUTF32BigEndianStringEncoding];
NSError *error = nil;
// In "real" code you should surround this with try and catch
NSDictionary * dict = [[[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error] retain];
if (dict)
{
rows = [dict objectForKey:@"news"];
}
NSLog(@"Array: %@",rows);
[jsonreturn release];
}
는 항상 null 값을 보여줍니다. 큰 문제입니다. NSData는 NSDictionary로 변환되지 않습니다. NSDictionary 변수는 null 값을 표시합니다.
도와주세요.
난 당신이 태그를 변경해야
json 문자열 파일 또는 webservice 중 하나를 사용하여 url을 변경하십시오. – aViNaSh