码迷,mamicode.com
首页 > 数据库 > 详细

SandBox沙盒

时间:2015-04-07 23:05:37      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:

沙盒:应用程序之间互相隔离

应用程序只能访问自己本地的内容,不能访问其他app文件目录(越狱手机除外)

为应用程序有自己的缓存和备份数据

写法:NSString* homeDirectory = NSHomeDrirectory();

NSString* appPath = [[NSBundle mainBundle]bundlePath];

1.获得沙盒文件中的文件

项目中的资源文件,会打包到沙盒中,比如plist文件、图片资源(),或者加载xib中的文件

如获得XXX.plist文件的路径

NSBundle bundle = [NSBundle mainBundle];

NSString* plistPath = [bundle pathForResource:@"XXX"ofType:"plist"];

plistPath中包含了对应文件路径的字符串。

2.加载xxx.xib对象

NSBundle bundle = [NSBundle mainBundle];

NSArray * objs = [bundle loadNibName:@"singleView"owner:nil options:nil];

objs就包含了xib中所有的文件对象。

SandBox沙盒

标签:

原文地址:http://www.cnblogs.com/fanxinguu/p/4399856.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!