iOS应用程序是否在其捆绑包内具有写入权限? [英] Does an iOS app have write access inside its bundle?

查看:205
本文介绍了iOS应用程序是否在其捆绑包内具有写入权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS应用程序的.app包中保存了一些运行时生成的文件。在模拟器中它工作正常,在它崩溃的设备中:

I save some run-time generated files inside the .app bundle of my iOS app. In the simulator it works fine, in the device it crashes:


可以在给定的着色器缓存路径中创建输出文件
' /var/mobile/Applications/CB064997-B40E-4FE3-9834-B3217CE33489/SimedTest.app/Ogre3D/assets/RTShaderLib/cache /

Could create output files in the given shader cache path '/var/mobile/Applications/CB064997-B40E-4FE3-9834-B3217CE33489/SimedTest.app/Ogre3D/assets/RTShaderLib/cache/

是否有一个很好的概述我应该和不应该放置文件 - 如何使用文档,库和tmp等?

Is there a good overview of where I should and shouldn't put files - how to use Documents, Library and tmp, etc?

为了澄清,这些是文件在启动时创建,预先计算一些数据以节省时间。如果它们不存在则会被创建,所以它们被删除很好,但是在应用程序运行时却没有。

To clarify, these are files created at startup which pre-calculate some data to save time. IF they are not present they get created so it's fine they are deleted, but not while the app is running.

推荐答案

捆绑包是只读的。你不想搞砸它有两个原因:

The bundle is read-only. You don't want to mess around with it for two reasons:


  • 代码签名:签名是根据捆绑包的内容进行验证的;如果你搞乱了捆绑包,你就会破坏签名。

  • 应用更新:通过用新下载的应用捆绑替换整个应用捆绑包来进行更新;你所做的任何改变都会丢失。

你应该保存的东西:


  • 文档:如果你想要它保持并被备份

  • 图书馆/缓存:如果你只想缓存下载的数据,比如个人资料照片;除非你指定一个特殊的do-not-delete标志,否则系统会自动删除它,除非你指定了一个特殊的do-not-delete标志。

  • tmp:临时文件,当你的应用没有运行时被删除

如需完整说明,请查看文件系统编程指南 QA1719

For a full explanation check out File System Programming Guide and QA1719.

这篇关于iOS应用程序是否在其捆绑包内具有写入权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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