zoukankan      html  css  js  c++  java
  • NSKeyedArchiver的基础用法

    LINK Address:http://blog.csdn.net/bl1988530/article/details/6559908

    1. NSString *str = @"abc";  
    2. NSString *astr = @"efg";  
    3. NSArray *Array = [NSArray arrayWithObjects:str, astr, nil];  
    4.        
    5. //保存数据  
    6. NSString *Path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *filename = [Path stringByAppendingPathComponent:@"test.plist"];  
    7. [NSKeyedArchiver archiveRootObject:Array toFile:filename];  
    8.        
    9. str = @"a";  
    10. astr = @"";  
    11.        
    12. //加载数据  
    13. NSArray *arr = [NSKeyedUnarchiver unarchiveObjectWithFile: filename];  
    14. str   =  [arr objectAtIndex:0];  
    15. astr =  [arr objectAtIndex:1];  
    16.        
    17. NSLog(@"str:%@",str);  
    18. NSLog(@"astr:%@",astr);  
  • 相关阅读:
    Spring Boot
    Spring Boot
    Spring Boot
    Restful API
    Jenkins
    虚拟化
    SpringBoot入门
    System Workbench for STM32(based on Eclipse)开发环境配置
    装机总结
    这年暑假
  • 原文地址:https://www.cnblogs.com/xingchen/p/2109248.html
Copyright © 2011-2022 走看看