[原]IOS 设备基本信息
1、获取设备类型 (Iphone/ipad 几?)
#import "sys/utsname.h"
-(NSString*)getDeviceVersion
{
    struct utsname systemInfo;
    uname(&systemInfo);
    NSString *deviceString = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
    return deviceString;
}
2、获取系统时间
NSDate* date = [NSDate date];  
    NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
    [formatter setDateFormat:@"yyyy-MM-dd HH:MM:SS"];
    [formatter stringFromDate:date];
3、获取应用版本 手机系统版本信息
UIDevice* uiDevice = [UIDevice currentDevice];  
    NSBundle* nsBundle = [NSBundle mainBundle];
    NSDictionary *infoDictionary = [nsBundle infoDictionary];
    NSString* crashInfo = [NSString stringWithFormat:@"Identifier:%@\nVersion:%@\nOS Version:%@     %@\nDate/Time:%@\nHardware Model:%@",
                        [nsBundle bundleIdentifier],
                        [infoDictionary objectForKey:@"CFBundleVersion"],
                        [uiDevice systemName],
                        [uiDevice systemVersion],
                        [self GetOnlyTime],
                        [self deviceString] ];
4、获取应用程序目录
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *cacheDir = [paths objectAtIndex: 0];
5、创建应用程序内部文件夹
NSFileManager *fm = [NSFileManager defaultManager];
        NSDictionary *attributes = [NSDictionary dictionaryWithObject: [NSNumber numberWithUnsignedLong: 0755] forKey: NSFilePosixPermissions];
        if(![fm fileExistsAtPath:"文件路径"]){
            
            [fm createDirectoryAtPath:"文件路径"withIntermediateDirectories:YES attributes:attributes error:NULL];
        }
6、获取某个文件夹下所有文件 及删除以某后缀名结尾文件
NSFileManager *fm = [NSFileManager defaultManager];
    NSArray *contents = [fm contentsOfDirectoryAtPath:path error:NULL];
    NSEnumerator *e = [contents objectEnumerator];
    NSString *filename;
    while ((filename = [e nextObject])) {
        NSLog(@"file Name = %@",filename);
        if ([[filename pathExtension] isEqualToString:@"txt"]||[[filename pathExtension] isEqualToString:@"plcrash"]) { 
           [path stringByAppendingPathComponent:filename];
        } 
    }
[原]IOS 设备基本信息的更多相关文章
- ios 设备基本信息检测
		开发ios确实会让人身心愉悦(相对于deskop,android),ios app更多的让人集中注意力到它本身的体验,性能.这非常好,我非常喜欢相对完美的事物. 最近遇到一些乱七八糟的需求.需要获取一 ... 
- 获取IOS 设备基本信息
		原地址:http://www.cnblogs.com/U-tansuo/p/ios_basis_info.html 1.获取设备类型 (Iphone/ipad 几?) #import "s ... 
- ios设备突破微信小视频6S限制的方法
		刷微信朋友圈只发文字和图片怎能意犹未竟,微信小视频是一个很好的补充,音视频到位,流行流行最流行.但小视频时长不能超过6S,没有滤镜等是很大的遗憾.but有人突破限制玩出了花样,用ios设备在朋友圈晒出 ... 
- Unity3D开发之“获取IOS设备所在的国家代码"
		原地址:http://dong2008hong.blog.163.com/blog/static/469688272014021025578/ 在前一段时间游戏开发中需要实现获取IOS设备所在的国家代 ... 
- IOS设备 UIDevice 获取操作系统 版本 电量 临近手机触发消息检测 (真机亲测可用)
		- (void)viewDidLoad { [super viewDidLoad]; // 操作系统 NSString * osName =[[UIDevice currentDevice]syste ... 
- 使用Safari远程调试iOS设备网页
		最近在做HTML 5游戏时,发布到手机上访问网页总是莫名其妙出现问题,苦于没有remote debug功能一直没有查找到问题. 这边博客详细介绍了iOS, Android, Windows Phone ... 
- 使用Fiddler对Android或者iOS设备进行抓包
		1.PC端Fiddler配置 Tools->HTTPS->选中“Decrpt HTTPS traffic”,“Ignore server certificate errors” Tools ... 
- 借助91助手,将ibook中的pdf文件拷贝至其它的pdf阅读器中(ios设备无需越狱)
		有时候在使用ios自带的ibook阅读pdf文件的时候,会发现ibook有些功能并不是那么方便.最近我就遇到了一例,我想在ibook中放一本比较大的pdf书,页数有几百吧,pdf文件本身每一章节都是有 ... 
- iOS设备的尺寸
		iOS设备的尺寸有两种统计单位:像素和点,对于程序员来说,只需要记住点即可. 常见的iOS设备的尺寸(点) 分辨率(点) 设备 分辨率(像素) 320*480 4.4s 320*480(4) 640* ... 
随机推荐
- Ionic学习资源
			http://www.qianduan.net/use-ionic-develop-hybrid-app/ 
- hive中使用with as查询作为临时中间表
			oracle.hive都存在with as的用法.用于将重复的查询结果复用. 今天做统计分析时用到,使用例子如下: 1. 直接查询 with tmp_a as ( select f1,f2,f3 fr ... 
- Java8中list转map
			第一种: 取list中某2个字段作为Map的K,V public Map<Long, String> getIdNameMap(List<Account> accounts) ... 
- linux brctl command not found
			[root@localhost ~]# brctl-bash: brctl: command not found 解决方法: [root@localhost ~]# yum install bridg ... 
- shell脚本路径写法的注意点
			1.在脚本中先cd到指定路径,再操作文件 2.如果不满足第一条,文件请写绝对路径 要不有可能会出现自己手动执行脚本没有问题,但是加入crontab却发现执行失败的情况. --------------- ... 
- Ubuntu 地址导航栏修改为显示路径及如何恢复原模式?
			在Ubuntu中,文件位置默认不是和Windows地址栏一样的(位置项),而是显示是路径名称组合(路径栏),这对于文件路径的获得复制很不方便.比如,获得某个文件德 路径,如果是地址栏,直接复制一下就可 ... 
- Item is not readable svn: 条目不可读
			问题:svn 查看资源历史记录失败 ,并提示"Item is not readable" 解决: 配置目录权限时如: [/]tangtx=rwyangcx=rwweishq=rw ... 
- applicationContext.xml报错org.springframework.orm.hibernate3.LocalSessionFactoryBean not found
			applicationContext.xml报错org.springframework.orm.hibernate3.LocalSessionFactoryBean not found 解决办法: 1 ... 
- CodeCombat地牢关卡Python代码
			最近迷上了玩CodeCombat,特将地牢关卡的Python代码整理如下,供有兴趣的人学习交流探讨 1,Kithgard地牢 hero.moveRight() hero.moveDown() hero ... 
- SpringBoot系列五:SpringBoot错误处理(数据验证、处理错误页、全局异常)
			声明:本文来源于MLDN培训视频的课堂笔记,写在这里只是为了方便查阅. 1.概念: SpringBoot 错误处理 2.具体内容 在之前的程序里面如果一旦出现了错误之后就会出现一堆的大白板,这个白板会 ... 
