无法找到iPhone模拟器的SQLite数据库:使用魔法记录

时间:2021-12-10 23:07:17

In my application's documents folder, I do not find my SQLite database

在我的应用程序的文档文件夹中,我找不到我的SQLite数据库

Library/Application Support/iPhone Simulator/6.1/"random app id"/Documents/

图书馆/应用程序支持/ iPhone模拟器/ 6.1 /“随机应用程序ID”/ Documents /

^This folder is empty

^此文件夹为空

MagicalRecord seems to be working, I just have no idea how to find the database.

MagicalRecord似乎正在工作,我只是不知道如何找到数据库。

I use the following to set up Magical Record

我使用以下内容设置魔法记录

[MagicalRecord setupAutoMigratingCoreDataStack];

So where does MagicalRecord store its database?

那么MagicalRecord在哪里存储它的数据库?

4 个解决方案

#1


4  

MagicalRecord stores, by default, all data stores in the following location:

默认情况下,MagicalRecord会将所有数据存储在以下位置:

{App Folder}/Library/Application Support/{App Name from Info.plist}/{storeName.sqlite}

{App Folder} / Library / Application Support / {Info.plist中的App Name} / {storeName.sqlite}

This is easily accessible from the simulator as well as documents.

这可以从模拟器和文档轻松访问。

#2


3  

You can log your SQlite file location using the following NSPersistentStore MR addition :

您可以使用以下NSPersistentStore MR添加来记录SQlite文件位置:

[NSPersistentStore MR_urlForStoreName:[MagicalRecord defaultStoreName]]

#3


0  

If you know the name of the sqlite file then just do a search in OSX for that file to find the directory. Otherwise the file was never created.

如果您知道sqlite文件的名称,那么只需在OSX中搜索该文件即可找到该目录。否则,永远不会创建该文件。

Make sure you are setting up the CoreData stack correctly as per the documents.

确保按照文档正确设置CoreData堆栈。

+ (void) setupCoreDataStackWithAutoMigratingSqliteStoreNamed:(NSString *)storeName;

#4


0  

Swift + Xcode 7 + simulator 9.0

Swift + Xcode 7 +模拟器9.0

Please go to your AppDelegate.swift

请转到您的AppDelegate.swift

change

MagicalRecord.setupCoreDataStackWithStoreNamed("yourDBName.sqlite")

to

MagicalRecord.setupCoreDataStackWithAutoMigratingSqliteStoreNamed("yourDBName.sqlite")

Now you can locate the yourDBName.sqlite at /Users/userName/Library/Developer/CoreSimulator/Devices/"random app id"/data/Containers/Data/Application/"random app id"/Library/Application Support/ProjectName

现在,您可以在/ Users / userName / Library / Developer / CoreSimulator / Devices /“random app id”/ data / Containers / Data / Application /“random app id”/ Library / Application Support / ProjectName中找到yourDBName.sqlite

There is a useful tool: simPHolders2 (http://simpholders.com) simPHolders easy to access all application folders

有一个有用的工具:simPHolders2(http://simpholders.com)simPHolders易于访问所有应用程序文件夹

#1


4  

MagicalRecord stores, by default, all data stores in the following location:

默认情况下,MagicalRecord会将所有数据存储在以下位置:

{App Folder}/Library/Application Support/{App Name from Info.plist}/{storeName.sqlite}

{App Folder} / Library / Application Support / {Info.plist中的App Name} / {storeName.sqlite}

This is easily accessible from the simulator as well as documents.

这可以从模拟器和文档轻松访问。

#2


3  

You can log your SQlite file location using the following NSPersistentStore MR addition :

您可以使用以下NSPersistentStore MR添加来记录SQlite文件位置:

[NSPersistentStore MR_urlForStoreName:[MagicalRecord defaultStoreName]]

#3


0  

If you know the name of the sqlite file then just do a search in OSX for that file to find the directory. Otherwise the file was never created.

如果您知道sqlite文件的名称,那么只需在OSX中搜索该文件即可找到该目录。否则,永远不会创建该文件。

Make sure you are setting up the CoreData stack correctly as per the documents.

确保按照文档正确设置CoreData堆栈。

+ (void) setupCoreDataStackWithAutoMigratingSqliteStoreNamed:(NSString *)storeName;

#4


0  

Swift + Xcode 7 + simulator 9.0

Swift + Xcode 7 +模拟器9.0

Please go to your AppDelegate.swift

请转到您的AppDelegate.swift

change

MagicalRecord.setupCoreDataStackWithStoreNamed("yourDBName.sqlite")

to

MagicalRecord.setupCoreDataStackWithAutoMigratingSqliteStoreNamed("yourDBName.sqlite")

Now you can locate the yourDBName.sqlite at /Users/userName/Library/Developer/CoreSimulator/Devices/"random app id"/data/Containers/Data/Application/"random app id"/Library/Application Support/ProjectName

现在,您可以在/ Users / userName / Library / Developer / CoreSimulator / Devices /“random app id”/ data / Containers / Data / Application /“random app id”/ Library / Application Support / ProjectName中找到yourDBName.sqlite

There is a useful tool: simPHolders2 (http://simpholders.com) simPHolders easy to access all application folders

有一个有用的工具:simPHolders2(http://simpholders.com)simPHolders易于访问所有应用程序文件夹