我已经陷入困境。我需要检索iphone内置应用程序占用的内存,如音乐,照片,电影,应用程序等......任何人都有想法请告诉我。
像显示细节一样。 How to get Storage Size of Applications programmatically in iPhone所以请帮帮我
答案 0 :(得分:1)
#import <mach/mach.h>
void report_memory(void)
{
struct task_basic_info info;
mach_msg_type_number_t size = sizeof(info);
kern_return_t kerr = task_info(mach_task_self(),
TASK_BASIC_INFO,
(task_info_t)&info,
&size);
if( kerr == KERN_SUCCESS )
{
NSLog(@"Memory in use (in bytes): %u", info.resident_size);
}
else
{
NSLog(@"Error with task_info(): %s", mach_error_string(kerr));
}
}
你可以看到以字节为单位的内存大小