당신은 디스크
-(uint64_t)getFreeDiskspace{
uint64_t totalSpace = 0.0f;
uint64_t 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 %llu MiB with %llu MiB Free memory available.", ((totalSpace/1024ll)/1024ll), ((totalFreeSpace/1024ll)/1024ll));
} else {
NSLog(@"Error Obtaining System Memory Info: Domain = %@, Code = %@", [error domain], [error description]);
}
return totalFreeSpace;
}
에서 사용 가능한 공간을 얻기 위해 다음 코드를 사용할 수 있으며
if([self getFreeDiskspace]>100.0){
//The store
}else{
//Alert user
}
는 희망이 도움이처럼 확인할 수 있습니다.
테스트를 마치면 테스트 해 보겠습니다. 감사 –