zoukankan      html  css  js  c++  java
  • 接口请求数据 缓存本地 .plist 文件

    //奖获取的数组或者字典存入   financeArr 数据数组

    1。//本地保存

                NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

                //获取完整路径

                NSString *documentsDirectory = [paths objectAtIndex:0];

                NSString *plistPath = [documentsDirectory stringByAppendingPathComponent:@"Test.plist"];//这里就是你将要存储的沙盒路径(.plist文件,名字自定义)

                [financeArr writeToFile:plistPath atomically:YES];

    2。//取出缓存

    //获取路径

        NSArray *sandboxpath= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

        NSString *filePath = [[sandboxpath objectAtIndex:0] stringByAppendingPathComponent:@"Test.plist"];

        //获取数据

        NSMutableArray *dataArr = [NSMutableArray arrayWithContentsOfFile:filePath];

    //dataArr就是得到缓存数据数组

    写的不好   有错误的地方望大家多多指点

  • 相关阅读:
    常用的STL
    CString,string,char数组的转换
    linux知识
    十一种通用滤波算法(转)
    修复被勒索病毒cl0p损坏的svn代码
    android shell 转发代理shell示例
    3proxy配置
    windbg调试写dmp,随机名字
    nexus6p刷机注意
    mysql语句学习
  • 原文地址:https://www.cnblogs.com/Lovexiaohuzi/p/7797366.html
Copyright © 2011-2022 走看看