对于沙盒Cocoa应用程序创建的临时文件 [英] Create temp file for a sandboxed Cocoa application

查看:137
本文介绍了对于沙盒Cocoa应用程序创建的临时文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序的沙盒的(按照最新的App Store的准则),我想创建一些临时文件。

My app is sandboxed (as per the latest App Store guidelines), and I want to create some temporary files.

我是否允许这样做?如果是,我在哪里可以做呢?是否有任何prespecified路径? (和一个命令来访问路径?)

Am I allowed to do so? If "yes", WHERE am I allowed to do it? Is there any prespecified path? (And a command to access that path?)

推荐答案

您应该使用 NSTemporaryDirectory()函数,它将查找并返回相应的临时文件夹为您应用程序(无论沙箱状态,操作系统版本,以及其他东西的主机)。看看此可可的爱情职位有关更多的细节 NSTemporaryDirectory()和其他临时目录相关的详细信息。

You should use the NSTemporaryDirectory() function, which will find and return the appropriate temporary folder for your application (regardless of sandbox status, OS version, and a host of other things). Take a look at this Cocoa With Love post for much more detail about NSTemporaryDirectory() and other temporary directory-related details.

这篇关于对于沙盒Cocoa应用程序创建的临时文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆