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

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

问题描述

我的应用是沙盒(根据最新的 App Store 指南),我想创建一些临时文件.

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

我可以这样做吗?如果是",我在哪里可以这样做?有没有预先指定的路径?(还有访问该路径的命令?)

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() 函数,该函数将为您的应用程序查找并返回适当的临时文件夹(无论沙箱状态如何)、操作系统版本以及许多其他内容).查看这篇 Cocoa With Love 帖子,了解更多关于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天全站免登陆