惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Palo Alto Networks Blog
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
博客园_首页
博客园 - 三生石上(FineUI控件)
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 【当耐特】
Microsoft Security Blog
Microsoft Security Blog
P
Privacy & Cybersecurity Law Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
S
Secure Thoughts
爱范儿
爱范儿
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
H
Help Net Security
The Cloudflare Blog
Recorded Future
Recorded Future
Attack and Defense Labs
Attack and Defense Labs
J
Java Code Geeks
O
OpenAI News
T
Tor Project blog
B
Blog RSS Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
PCI Perspectives
PCI Perspectives
V
Visual Studio Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
A
About on SuperTechFans
www.infosecurity-magazine.com
www.infosecurity-magazine.com
W
WeLiveSecurity
Cyberwarzone
Cyberwarzone
云风的 BLOG
云风的 BLOG
Security Latest
Security Latest
S
Schneier on Security
Know Your Adversary
Know Your Adversary
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Vulnerabilities – Threatpost
D
DataBreaches.Net
宝玉的分享
宝玉的分享
T
Troy Hunt's Blog
V
V2EX
Cisco Talos Blog
Cisco Talos Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Latest news
Latest news
量子位
Microsoft Azure Blog
Microsoft Azure Blog

博客园 - 1901

试用Github Pages iOS设备内存及分辨率 测试显示GitHub的Gist 使用GTMBase64编码解码字符串 颜色转换工具 先随便记一下 mac字典词库增加方法 Google的Logo记现代舞先驱玛莎·葛兰姆117周年诞辰-Flash版 关于flash加载flash时的缩放和位置问题 给力壁纸 for mac 【转载】巧用宏定义来简写C,C++代码 Objective-C中的NSObject对象经常使用到的方法 Objective-C属性介绍 应用程序本地化-国家代码介绍(ISO 3166-1) iPhone开发资料 sourceMate2 我在MACOS下常用的软件 【转载】分享一些FLASH开发时用到的工具~ 关于ActionScript3中的事件类强制转换失败的问题
iOS中获取程序相关的一些目录路径
1901 · 2011-05-31 · via 博客园 - 1901

// 获取程序Documents目录路径
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString
*documentsDirectory = [paths objectAtIndex:0];// 获取程序app文件所在目录路径
NSHomeDirectory();// 获取程序tmp目录路径
NSTemporaryDirectory();// 获取程序应用包路径
[[NSBundle mainBundle] resourcePath];

[[NSBundle mainBundle] pathForResource:
@"info" ofType: @"txt"];

另外对于文件一些主要操作主要是通过NSFileManage 来完成,可以通过 [NSFileManger defaultManger] 得到它得实例。

如:创建目录、重命名文件、获取目录下的文件名、删除文件、删除目录等。

其他:

在使用的时候我准备向NSHomeDirectory()获取到的目录中写一个文件但是失败了。

后来写到Documents目录中了,不知道是iOS的限制还是什么,文件不能写到NSHomeDirectory()目录下。