本文主要是介绍NSProcessInfo获取进程信息,UIDevice获取设信息,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#import <Foundation/Foundation.h>int main(int argc, const char * argv[]) {@autoreleasepool {//获取当前进程对应的ProcessInfo对象NSProcessInfo *proInfo = [NSProcessInfo processInfo];//获取运行改程序所指定的参数NSArray *arr = [proInfo arguments];NSLog(@"运行程序的参数为:%@",arr);NSLog(@"进程标识符为:%d",[proInfo processIdentifier]);NSLog(@"进程的进程名为:%@",[proInfo processName]);NSLog(@"进程所在系统的主机名:%@",[proInfo hostName]);NSLog(@"进程所在系统的操作系统为:%lu",(unsigned long)[proInfo operatingSystem]);NSLog(@"进程所在系统的操作系统名为:%@",[proInfo operatingSystemName]);NSLog(@"进程所在系统的操作系统版本字符串为:%@",[proInfo operatingSystemVersionString]);NSLog(@"进程所在系统的物理内存为:%lld",[proInfo physicalMemory]);NSLog(@"进程所在系统的处理器数量为:%ld",[proInfo processorCount]);NSLog(@"进程所在系统的激活的处理器数量为:%ld",[proInfo activeProcessorCount]);NSLog(@"进程所在系统的运行时间为:%f",[proInfo systemUptime]);}return 0; }
这篇关于NSProcessInfo获取进程信息,UIDevice获取设信息的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!