0
나는 방법 아래에서 사용 가능한 메모리를 얻고있다 : 메소드가 리턴 위ipad의 잘못된 사용 가능한 메모리를 얻고 있습니까?
static void print_free_memory() {
float totalSpace = 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];
totalSpace = [fileSystemSizeInBytes floatValue];
NSLog(@"Total memory:%f",totalSpace);
freeMemAvailable = [[dictionary objectForKey:NSFileSystemFreeSize] floatValue];
NSLog(@"Free Memory:%f",freeMemAvailable);
} else {
NSLog(@"Error Obtaining File System Info: Domain = %@, Code = %@", [error domain], [error code]);
}
}
= 9139.650391 메가 바이트 ~ 9.14 GB 및 디바이스 메모리에이 장치 = 8.4 GB
약 700 메가 바이트 차이에 표시됩니다. 왜 그래야만하지? 어떤 제안.
장치의 장치 메모리를 확인하는 데 사용한 경로는 다음과 같습니다. 로 이동 : - 설정 -> 일반 -> 정보 -> 사용 가능한
감사 오마르만큼 크지 않다. 당신 말이 맞아요. 나는 10^6으로 나누고 있었다. 하지만 여전히 ~ 100 MB의 차이가 있습니다. 어떤 생각? – iDilip
이 100MB는 내가 아는 것이 아니라, 더 자세히 조사 할 것입니다. –