iOS 在哪里保存它的数据文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23877286/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 00:13:46  来源:igfitidea点击:

Where does iOS keep its data folder

iosmobilerootjailbreak

提问by Andrei Ciuca

In Android, if you have root, you can access a folder /data/data/<package name>

在Android中,如果您有root,则可以访问文件夹 /data/data/<package name>

In this folder you can find databases or other files for your project.

在此文件夹中,您可以找到项目的数据库或其他文件。

Is this folder available on iOS if you have Jailbreak?

如果您有越狱,此文件夹是否在 iOS 上可用?

I did find some root explorers for iOS but I was not able to find that folder.

我确实找到了一些适用于 iOS 的根资源管理器,但找不到该文件夹​​。

回答by Nate

Android and iOS are completely different operating systems, so you shouldn't expect them to have the same file system layout.

Android 和 iOS 是完全不同的操作系统,因此您不应期望它们具有相同的文件系统布局。

In iOS, typically, apps store their data in a folder named Documents, that is saved in a location next to where the app itself is installed (†).

在 iOS 中,通常,应用程序将其数据存储在名为 的文件夹中Documents,该文件夹保存在应用程序本身安装位置 (†) 旁边的位置。

For example, for 3rd-party (App Store) apps, the app is installed under /var/mobile/Applications/(†) and then a folder that's named with a unique identifier string. Under thatfolder, you will find the app at MyAppName.app. On the same level, you'll see a Documentsfolder, that isautomatically created for you. So, a complete folder hierarchy might look like this:

例如,对于 3rd-party (App Store) 应用程序,应用程序安装在/var/mobile/Applications/(†) 下,然后是一个以唯一标识符字符串命名的文件夹。在文件夹下,您将在 MyAppName.app 中找到该应用程序。在同一水平上,你会看到一个Documents文件夹,那自动为您创建。因此,完整的文件夹层次结构可能如下所示:

iPhone5:/var/mobile/Applications root# find . -name Netflix.app
./882F75CD-F42D-4532-8C77-D0992192606B/Netflix.app
iPhone5:/var/mobile/Applications root# cd ./882F75CD-F42D-4532-8C77-D0992192606B/
iPhone5:/var/mobile/Applications/882F75CD-F42D-4532-8C77-D0992192606B root# ls
Documents/  Library/  Netflix.app/  StoreKit/  iTunesArtwork  iTunesMetadata.plist  tmp/

It is important to note that you do notneed a jailbroken phone to access this folder. You can install a tool like iBrowseon your computer, and use that to browse the Documents folder of your 3rd-party apps.

你做到这一点是需要注意的重要并不需要一个越狱的手机访问此文件夹。您可以在您的计算机上安装iBrowse 之类的工具,并使用它来浏览您的 3rd 方应用程序的 Documents 文件夹。

enter image description hereHowever, if you want to be able to browse anyfolder on the filesystem, you would have to jailbreak the phone, and then could use iBrowse, or just ssh, to get into wherever you like.

在此处输入图片说明但是,如果您希望能够浏览文件系统上的任何文件夹,则必须越狱手机,然后可以使用 iBrowse 或 ssh 进入您喜欢的任何地方。

Another note is that if you are building a "system" application for a jailbroken device, that will be installed under /Applications/, instead of /var/mobile/Applications/(†), then you actually doneed to manually create a documents folder for your app. See this tutorial for more about that(see bottom of page), or read this answer.

另一个注意事项是,如果您正在为越狱设备构建“系统”应用程序,该应用程序将安装在/Applications/, 而不是/var/mobile/Applications/(†) 下,那么您实际上确实需要为您的应用程序手动创建一个文档文件夹。有关更多信息,请参阅本教程(请参阅页面底部),或阅读此答案

Update (†)

更新 (†)

In recent versions of iOS (8+, I believe), the 3rd-party data folders have moved. What was in /var/mobile/Applications/is now under /var/mobile/Containers/Data/Application/. App bundles and their data/documents folders have been separated on the filesystem.

在最近的 iOS 版本(我相信8+ )中,第 3 方数据文件夹已经移动。以前的东西/var/mobile/Applications/现在在/var/mobile/Containers/Data/Application/. 应用程序包及其数据/文档文件夹已在文件系统上分开。

回答by Shree Harsha S

iOS apps store data locally in different ways like plist(similar to shared_pref in android), NSUserDefaults, Core data(sqlite), Keychain.

iOS 应用程序以不同的方式在本地存储数据,例如 plist(类似于 android 中的 shared_pref)、NSUserDefaults、Core data(sqlite)、Keychain。

Theses files can be found using any file explorer utility under the application folder.

这些文件可以使用应用程序文件夹下的任何文件资源管理器实用程序找到。

回答by Michael Dautermann

No, that folder doesn't exist by default under iOS unless you (or somebody else) created it.

不,该文件夹在 iOS 下默认不存在,除非您(或其他人)创建了它。