기기 이름, 유형, 디스크 공간 및 iOS 버전과 같은 일부 기기 정보를 읽으려면이 작업을 수행하십시오. 장치가 iPad, iPhone 또는 망막인지 알 수있는 몇 가지 방법이 있지만 장치에 대해 더 이상 알지 못하는 경우가 있습니다.코코아 터치 - 기기 정보 얻기
2
A
답변
6
읽기 아이폰 OS 버전 :
NSString* iOSVersion = [[UIDevice currentDevice] systemVersion];
읽기 아이 패드 모델 :
- (NSNumber *) totalDiskSpace
{
NSDictionary *fattributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil];
return [fattributes objectForKey:NSFileSystemSize];
}
- (NSNumber *) freeDiskSpace
{
NSDictionary *fattributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil];
return [fattributes objectForKey:NSFileSystemFreeSize];
}
:
BOOL isIPad2 = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad &&
[UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]);
NSString* iPadModel = [[UIDevice currentDevice] model];
if (isIPad2)
iPadModel = @"iPad2";
무료/전체 공간 디스크 읽기
3
이
float totalSpace = 0.0f;
float totalFreeSpace = 0.0f;
NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
if (dictionary) {
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
totalSpace = [fileSystemSizeInBytes floatValue];
totalFreeSpace = [freeFileSystemSizeInBytes floatValue];
NSLog(@"Memory Capacity of %f MiB with %f MiB Free memory available.", ((totalSpace/1024.0f)/1024.0f), ((totalFreeSpace/1024.0f)/1024.0f));
} else {
NSLog(@"Error Obtaining System Memory Info: Domain = %@, Code = %@", [error domain], [error code]);
}
NSLog(@"%f",totalFreeSpace);
이 장치의 이름을 찾으려면
[[UIDevice currentDevice] systemVersion];
디스크 공간을 찾으려면 IOS 버전을 확인하려면
NSLog(@"%@",[[UIDevice currentDevice] name]);
관련 문제
- 1. UIImageView의 코코아 터치 터치
- 2. 코코아 터치 :
- 3. 코코아 터치 : 로그인보기/표보기/세부보기
- 4. 기기 정보 (웹 브라우저)
- 5. Android 기기 정보
- 6. iPhone : 코코아 터치 화면에서 클릭 가능한 영역 목록 얻기
- 7. 코코아 터치 NSRegularExpression 패턴
- 8. 코코아 터치 - UIAnimation 질문
- 9. 코코아 터치 NStimer 문제
- 10. 코코아 터치 - AVFoundation
- 11. 코코아 터치 - 모션 감지?
- 12. 코코아 터치 - 버튼 누르기
- 13. 코코아 터치 : 메모리 관리
- 14. 코코아 터치 - 대화 상자?
- 15. 코코아 터치 : 텍스트 장식
- 16. 코코아 터치 - 메모리 관리
- 17. 코코아 터치 - 로딩 AVAudioPlayer
- 18. 코코아 터치 - 타이머
- 19. 코코아 터치 - 분할 컨트롤
- 20. 코코아 터치 UITableView 데이터
- 21. 코코아 터치 - 뷰
- 22. UILabel 코코아 터치 깜박임
- 23. 코코아 터치 구현 파일?
- 24. 코코아 터치 데이터 지속성
- 25. 코코아 터치 - 타이머로 애니메이션하기
- 26. 코코아 터치 - UITextView 색상
- 27. 코코아 터치 - 프레임보기
- 28. 코코아 터치 - 키보드 캡처
- 29. 분필 효과가있는 문자열을 그립니다 (코코아/코코아 터치)?
- 30. Quicktime Movie에서 EXIF 정보 얻기