티스토리 뷰

안녕하세요.

이제 막 아이폰 개발 공부를 시작했습니다.


블로그에도 관련 포스팅이 많이 늘어날것같네요.!


오늘 그 시작으로 JSOINKit 라이브러리를 정리해놓습니다.


기본 JSON파싱보다 약 3배 빠르다고하네요!



https://github.com/johnezang/JSONKit


에서 다운가능합니다.

.h, .m 2개의 파일로 구성되어있습니다 (정말 간단하죠!)



사용법 

#import "JSONKit.h"

... 


NSString *filePath = [[NSBundle mainBundle] pathForResource:@"items" ofType:@"json"];   

NSString *a = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];

    

// 클래스의 종류  내용보기 

//    NSLog(@"class:%@ a:%@",[a class], a);

    

// JSON NSArray NSDictionary  변환 

NSArray *array = [a objectFromJSONString];

NSLog(@"class: %@, %d", [array class], [array count]);

    

// Array에서 Dictionary 가져오기 

NSDictionary *dic = [array objectAtIndex:0];

NSLog(@"dic name:%@", [[dic valueForKey:@"name"] description]);





빌드하면 ARC 에러가 나면? 
http://j2enty.tistory.com/107 arc에러 대처

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함