Xcode 5 / Mavericks - Cocoa Core Data SQLite DB位置 [英] Xcode 5/Mavericks - Cocoa Core Data SQLite DB Location

查看:132
本文介绍了Xcode 5 / Mavericks - Cocoa Core Data SQLite DB位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过其他问题,询问同样的问题,他们都标记为已回答,但他们提供的答案不适合我。

I've seen other questions asking the same thing and they're all marked as "answered" but the answers they provide are not working for me.

我在Xcode 5中创建了一个基础可可应用程序,并使其成为一个核心数据/文档应用程序。我在Core Data中添加了几个条目,当我阅读它们时,可以在NSLog中看到它们...现在我的sqlite DB位于哪里?

I created a base cocoa application in Xcode 5 and made it a Core Data/Document app. I added a few entries to Core Data and can see them in NSLog when I read them back... now where is my sqlite DB located?

我检查:
〜/ Library / Containers /

I checked: ~/Library/Containers/

我的应用程式不存在。

$ b〜/ Library / Developer / XCode / DerivedData /

I checked: ~/Library/Developer/XCode/DerivedData/

我发现我的应用程序在那里,但我浏览了每一个文件夹,根本找不到SQLite 。

And I found my app there, but I went through every single folder and can't find the SQLite at all.

任何人都可以告诉我这是在哪里?这是一个Mac OSX应用程序,而不是iOS应用程序。

Can anyone tell me where this is at? This is a Mac OSX app, not an iOS app.

推荐答案

数据存储文件是...无论你放在哪里。该位置不是自动生成的,它在你的代码说它应该是。具体来说,当调用 addPersistentStore:时,传入确定位置的文件URL。找到该调用,并查看它使用的是什么路径。

The data store file is... Wherever you put it. The location is not automatically generated, it's wherever your code says it should be. Specifically, when you call addPersistentStore:, you pass in a file URL that determines the location. Find that call and see what path it's using.

通常,但不总是,这是在应用程序支持文件夹中。如果你的应用程序是沙盒,那么它在〜/ Library / Containers / 。如果你的应用程序没有沙箱,那么它在〜/ Library / Application Support / 中的某个地方。

Commonly, but not always, this is in the Application Support folder. If your app is sandboxed then that's somewhere in ~/Library/Containers/. If your app is not sandboxed then it's somewhere in ~/Library/Application Support/.

但是商店不一定要在应用程序支持中。它可以在您的应用程序具有文件写入权限的任何位置。如果你的应用程序没有沙箱,它可以去当前用户有文件写权限的任何地方。它在任何你告诉Core Data放置它。

But the store doesn't have to be in Application Support. It can be anywhere that your app has file write privileges. If your app isn't sandboxed, it could go anywhere that the current user has file write privileges. It's wherever you tell Core Data to put it.

这篇关于Xcode 5 / Mavericks - Cocoa Core Data SQLite DB位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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