zoukankan      html  css  js  c++  java
  • iOS文件操作

      //找到Documents文件所在的路径
        NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        //取得第一个Documents文件夹的路径
        
        NSString *filePath = [path objectAtIndex:0];
        
       
        
        NSString *plistPath = [filePath stringByAppendingPathComponent:@"collectionData.plist"];

        //存入(沙盒)
        [data writeToFile:plistPath atomically:YES];
        //读取(沙盒)
        NSArray *arr1 = [NSArray arrayWithContentsOfFile:plistPath];
         NSLog(@"%@",plistPath);
        NSLog(@"%@",arr1);
        
        NSString *bundlePath = [[NSBundle mainBundle]pathForResource:@"collectionData" ofType:@"plist"];
        NSLog(@"%@",bundlePath);
        //读取(Bundle)
        NSArray *arr2 = [NSArray arrayWithContentsOfFile:bundlePath];
        NSLog(@"---------%ld",arr2.count);

  • 相关阅读:
    shell的正则表达式
    shell语法
    shell通配符
    shell小命令
    DNS
    CCNA参考链接
    Network problem solving flow chart
    我是一个路由器
    我是一个网卡
    Chrome
  • 原文地址:https://www.cnblogs.com/hxwj/p/4602892.html
Copyright © 2011-2022 走看看