如何查看存储在 Core Data 中的数据? [英] How to view data stored in Core Data?
问题描述
我正在为我的应用程序创建一个 Core Data 模型.我希望能够查看它的内部,看看我在那里存储了什么.
I'm creating a Core Data model for my application. I would like to be able to look inside it to see what I have stored in there.
是否有一种比搜索后备存储区(我的应该是 SQLite)并从那里读取它更简单的方法?看起来不太像苹果.
Is there an easier way than searching for the backing store (mine should be SQLite) and reading it from there? Doesn't seem very Apple-esque.
推荐答案
一旦您的应用在模拟器中运行并创建了持久存储文件,您就可以在应用的 Documents 目录中找到该文件.
Once your app has run in the simulator and created the persistent store file, you can find the file in your app's Documents directory.
您的应用数据将在文件夹内(~ 是您的主目录):
Your app data will be folder inside (~ is your home directory):
~/Library/Developer/CoreSimulator/
在 XCode 6 之前的版本中,路径为:
In versions prior to XCode 6, the path was:
~/Library/Application Support/iPhone Simulator/User/Applications/
我按修改日期"排序以找到我刚刚构建的应用程序.
I sort by "Date Modified" to find the app that I just built.
要查看 SQLite 文件,请查看 Base 和/或 核心数据编辑器.
For viewing a SQLite file, check out Base and/or Core Data Editor.
这篇关于如何查看存储在 Core Data 中的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!