NSLog가 전체 JSON 파일을 출력 할 수있는 방법이 있습니까? "(널) = JSON 파일을"Xcode NSLog를 JSON하는 방법
덕분에 나는 현재
NSString *deviceInfo = [NSString stringWithFormat:@"%@ %@",
[[UIDevice currentDevice]model], [[UIDevice currentDevice]systemVersion]];
NSDictionary *json = [deviceInfo JSONValue];
NSLog(@"json file = %@", json);
을 말하고 그리고 밖으로 인쇄하는 클린턴
꽤 잘하고 있습니다. 현재이'{ "deviceModel": "iPod touch", "deviceSystemVersion": "4.3.5"}'를 인쇄하고 각각의 외부에 여러 개의 블록과 무언가를 "하드웨어" : { "deviceModel": "iPod touch"} "os": { "deviceSystemVersion": "4.3.5"}'어떻게할까요? –
사전을 중첩하면됩니다. '[NSDictionary dictionaryWithObjectsAndKeys : someDictionary, @ "someKey", someOtherDictionary, @ "someOtherKey", nil]' –
예, 성공했습니다. 한가지 더. NSDictionary에서 순서를 변경할 수없는 것처럼 보입니다. NSDictionary * fullJSON = [NSDictionary dictionaryWithObjectsAndKeys : 하드웨어, @ "hw", os, @ "os", nil]; '하지만, {{ "os": { "ver": "4.3.5" } "hw": { "model": "iPod touch"}}'나는 필요 없다고 생각하지만 하드웨어를 먼저 만들 수 있다면 좋을 것 같습니다. –