zoukankan      html  css  js  c++  java
  • sandBoxPathFile

     //获得本应用程序的沙盒目录

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

        NSString *path=[array objectAtIndex:0];

        NSLog(@"%@",path);

        

        //每个应用程序都有自己的沙盒目录,应用程序之间不能够相互访问沙盒目录

        //沙盒目录下具有Documents,Libray,temp

        //Documents目录下的文件会在itunes备份和恢复时一起备份到服务器和恢复到手机,程序中自己创建的文件需要放到Documents目录下

        //Libray存放的是系统的系统库,应用程序不能使用Libray目录

        //tmp目录存放临时文件,当从新启动时,会删除tmp目录下所有文件

        

        NSDictionary *dict=[[NSDictionary alloc]initWithObjectsAndKeys:@"a",@"b", nil];

        NSString *sandBoxPathFile=[NSString stringWithFormat:@"%@/abc.plist",path];

        //向本应用程序的沙盒目录的Documents文件下写入abc.plist

        [dict writeToFile:sandBoxPathFile atomically:YES];

        

        //读文件

        NSDictionary *readDict=[[NSDictionary alloc]initWithContentsOfFile:sandBoxPathFile];

        NSLog(@"%@",readDict);

  • 相关阅读:
    浅拷贝和深拷贝
    squeezenet
    7常用函数
    6表的约束
    5select的运用
    4操作符
    3基本数据操作
    2基本数据类型
    1mysql的安装
    16多态
  • 原文地址:https://www.cnblogs.com/y16879w/p/4448663.html
Copyright © 2011-2022 走看看