Mobile/iOS 개발 팁

[iOS/Dev] iOS Device Platform String 확인 방법

GoodYoda 2014. 10. 19. 16:31

# 런타임, 코드를 통하여 확인

size_t size;

sysctlbyname("hw.machine", NULL, &size, NULL, 0);

char *machine = malloc(size);

sysctlbyname("hw.machine", machine, &size, NULL, 0);

NSString *platformString = [NSString stringWithCString:machine encoding:NSASCIIStringEncoding];

free(machine);


# 디바이스가 없는 경우 아래의 경로에서 확인

- Xcode의 시뮬레이터 디바이스 타입 목록 경로 접근

  : /Applications/Xcode6 GM2/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/Profiles/DeviceTypes

- 해당 경로의 디바이스의 리소스 프로파일을 통하여 확인

  : /Applications/Xcode6 GM2/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/Profiles/DeviceTypes/iPhone 6 Plus.simdevicetype/Contents/Resources