省市区代码
2016-07-25 17:22
337 查看
- (NSMutableArray*)getAddressDataSource
{
NSString *dataPath=[NSHomeDirectory() stringByAppendingString:@"/Documents/newcity.txt"];
NSData *data = [[NSData alloc] initWithContentsOfFile:dataPath];
TTDPRINT(@"========%ld",[data length]);
if([data length]<1000){
dataPath= [[NSBundle mainBundle] pathForResource:@"newcity" ofType:@"txt"];
data = [[NSData alloc] initWithContentsOfFile:dataPath];//914843
}
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
NSMutableArray *array = [unarchiver decodeObjectForKey:@"user"];
TTDPRINT(@"===地区array=====%@",array);
return array;
}
{
NSString *dataPath=[NSHomeDirectory() stringByAppendingString:@"/Documents/newcity.txt"];
NSData *data = [[NSData alloc] initWithContentsOfFile:dataPath];
TTDPRINT(@"========%ld",[data length]);
if([data length]<1000){
dataPath= [[NSBundle mainBundle] pathForResource:@"newcity" ofType:@"txt"];
data = [[NSData alloc] initWithContentsOfFile:dataPath];//914843
}
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
NSMutableArray *array = [unarchiver decodeObjectForKey:@"user"];
TTDPRINT(@"===地区array=====%@",array);
return array;
}
相关文章推荐
- 跟我读Spring——Spring源码浅析(前序)
- 串口通讯的python模块——pySerial
- c++较好程序:实现或的操作
- php验证码不能显示的原因
- C语言,struct,union
- eclipse svn插件 links方式
- 脑残用户登录代码调优
- myeclipse中的类恢复之前的版本方法
- C++ hdoj 2042 不容易系列二
- C++中的头文件和源文件
- com.alibaba.dubbo.rpc.RpcException
- Yii2 验证码
- 中文目录乱码解决或者打开中文图片出错
- Eclipse 通过JPA自动生成注解实体
- Java编程思想第4版-第三章
- **PDO** PDO简介
- webdriver 关于元素的常用操作 python版本
- Spring系列之对Bean的认识
- java实现post方法
- Java中ArrayList和LinkedList区别