iOS 어플상에서 기기의 종류를 알아올 수 있는 코드이다.
#include <sys/sysctl.h> // sysctlbyname 의 사용을 위해 // 모델 정보 보기 - 상세히 + (NSString *) platform { size_t size; sysctlbyname("hw.machine", NULL, &size, NULL, 0); char *machine = malloc(size); sysctlbyname("hw.machine", machine, &size, NULL, 0); /* Possible values: "i386" = iPhone Simulator "iPhone1,1" = iPhone 1G "iPhone1,2" = iPhone 3G "iPhone2,1" = iPhone 3GS "iPhone3,1" = iPhone 4 "iPod1,1" = iPod touch 1G "iPod2,1" = iPod touch 2G "iPod3,1" = iPod touch 3G */ NSString *platform = [NSString stringWithUTF8String:machine]; free(machine); return platform; }
출처 : http://cafe.naver.com/mcbugi/81305
'소프트웨어 개발 > iOS' 카테고리의 다른 글
[iOS 개발팁] 아이폰 어플에서 AppStore 검색페이지로 이동하기 (1) | 2011.02.27 |
---|---|
[iOS 개발팁]target/selector를 한번에 관리하자. (0) | 2011.01.26 |
[iOS 어플]오히려 retain을 하면 안되는 경우 (메모리 릭 문제 막자!) (3) | 2010.12.30 |
[아이폰어플] Reachability로 네트워크 상태 감지 (1) | 2010.12.18 |
아이폰 메모리 관리 retain 과 release(autorelease)를 잘하자. (3) | 2010.12.18 |