- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
据我所知(并到处阅读)应用程序的文档目录应该位于 iPhone 上的 /var/mobile/Library/
中,但如果我记录所获取的目录,它是 /var/mobile/Documents
。
我得到的目录如下:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
如果我在此处创建名为 Settings.xml
的文件,或者我的应用程序/等有问题,这会是一个问题吗?
信息:我有一部装有 iOS 4.2.1 的越狱 iPhone 4,我的应用程序是通过 Cydia 或 SSH 安装的。
<小时/>更新
是的,但是该目录与我的应用程序并不真正相关。例如,我正在创建一个文档 settings.xml,如果另一个应用程序使用相同的 NSDocumentDirectory 和相同的文件名怎么办?是的,我知道。 Cydia 应用程序已安装到/Applications 中,但我的应用程序也应该有一个文档目录,甚至没有/var/mobile/Documents。如果你看一下http://thebigboss.org/hosting-repository/submit-your-app/compile-for-cydia-submission该目录应该是/var/mobile/Library/但正如我之前所描述的,我从未得到过这个目录。
最佳答案
在运行越狱应用程序时,使用常量 NSDocumentDirectory
实际上会获得/var/mobile/Documents。将应用程序的文档直接转储到那里将是一个糟糕的策略,即使您认为它们的名称是唯一的。
如果您查看/var/mobile/Library/文件夹的内容,您会发现许多应用程序都存储了数据,包括越狱应用程序。我不清楚是否有像 NSDocumentDirectory 这样方便的常量可以用来获取它。但是,您始终可以对源代码进行硬编码以查找 @"/var/mobile/Library/APPNAME"
中的文件。这个文件夹不太可能改变(如果改变了,它可能会破坏其他应用程序,而且修复起来肯定很容易)。
如果你看一下文档you link to ,它确实指定:
Appstore app has a Documents folder that is created by the installation process. Jailbroken app does not. It is up to the app to create its own folder. Should you need this type of folder, you must create this with a simple mkdir command in your applicationDidFinishLaunching function. Just add a simple function: mkdir(“/var/mobile/Library/YOURAPPNAME”, 0755); If the folder already exists, no harm done. You want to do this because the install process runs as user root and the app runs as user mobile. If Cydia does this for you then the folder will have the incorrect permissions.
...因此您需要自己创建该子目录。如果你不这样做,它就不会在那里。
根据我的经验,编写越狱应用程序只涉及一些稍微有点臭的编码实践(硬编码路径并自己创建它们)......这可能只是我们必须处理的事情。
更新:请务必查看下面 Saurik 的评论。
关于iphone - iPhone应用程序的文档目录是/var/mobile/Documents还是/var/mobile/Library/AppName?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4650488/
谁能告诉我在定义对象之前使用三元运算符检查对象是否已经存在的原因? var message = message || "hello", messageOverwritten = "Variab
我们正在部署 Tomcat 应用程序 (.war) 一旦部署,它只能在中访问 http:\本地主机\应用名称\应用名称 而不是 http:\localhost\appname Faces S
我的应用程序有一个 Activity ,它在浏览器中启动 oauth 授权过程,最后浏览器收到重定向到 url“appname://com.appname”的链接,该 Activity 回调到我的 A
谁能向我解释一下 appName.app 和 appName.app.dsYM 文件之间的区别以及哪个文件在 AppStore 上提交?当我在查找器中检查时,两个文件的大小不同,所以我很困惑 Appl
我构建了一个应用程序以将其交付到 AppStore,但验证过程抛出此错误: The app references non-public selectors in Payload/.app/: cate
我正在尝试创建一个允许我的 WPF 应用程序探查本地 lib 文件夹的 app.config。但是,在构建我的项目时,我没有得到我的 app.config 的 exe 版本。重命名 .dll 文件也不
我有两个域 APPNAME.herokuapp.com 和 APPNAME.com 。我刚刚设置了APPNAME。我想以这样一种方式设置谷歌分析,以便它跟踪两个域相同。换句话说,我想防止“丢失”任何页
我正在开发一个 python 包(仅限 linux)并使用 distutils。我想将配置文件放在/etc/中,将日志文件放在/var/log/或此类文件的另一个常见目标中。 Setuptools 有
ldd -v 应用名 linux-gate.so.1 => (0x00949000) libpthread.so.0 => /lib/libpthread.so.0 (0x00cea000) lib
我正在将我的 iOS 应用程序上传到应用程序商店,当我上传该应用程序时出现了一些警告。警告是 app references non-public selectors in payload/appnam
我正在尝试创建一个应用程序,根据选定的颜色记录当前日历日的单元格。我已经使该部分正常工作,但后来我添加了另一个名为“ToDoViewViewController”的 UIViewController,
我正在尝试从网络获取数据并尝试使用 AZTableView 库进行分页。我面临上述错误。这是我的代码 我的模态类 class JobsNearBy: NSObject { var jobId: Int
我们正在使用 AfterBuild目标在 vbproj根据所选配置替换配置文件: 例如,假设我们有 3 种配置:调试、测试、发布。 Debug是本地调试配置。测试是用于用户验收测试的预
今天,我尝试使用 Xcode 5 向商店提交我的应用程序更新。它给出了警告 The app references non-public selectors in Payload/.app/: setA
我正在构建一个基于示例应用程序的应用程序,在 .NET 2 上用 C# 编写,并构建在 VS2008 上。此应用程序主要是 COM 应用程序的包装器。但是我在 .NET 3.5 中编译它。 示例应用程
我已经外化了我的 Grails 配置,基本上与配置文件建议的方式相同。 我一直在用我的 1.3 项目和线路完成它 grails.serverURL = "http://localhost:8080/$
我刚刚升级到Xcode 4.4.1,并加入了Apple Developer Program。我设置了Developer Provisioning配置文件,并在我的设备上获得了所有正确的凭据。然后,当我
我在通过 Xcode 软件在 iPad 上安装我的应用程序时遇到了问题,而没有将它上传到 Apple Store。我注意到几天后该应用程序停止工作并且无法打开并显示一条消息(“应用程序名称”不再可用)
我有以下build.gradle片段。 第一行工作正常,如果我未指定版本,则使用1.0.0-SNAPSHOT。 但是第二行不起作用。我收到“无法获取项目的未知属性'appName'” 知道如何在gra
我的问题很简单-Config.groovy中的$ {appName}属性替换似乎对我不起作用。 我有一个名为path.to.resources = ${appName}/videos的配置项,但是当我
我是一名优秀的程序员,十分优秀!