Core data 无法使用RestKit 0.2定位sqlite数据库
我在我的项目中使用RestKit 0.2和CoredData,但在我的项目中找不到sqlite数据库文件。通常(不带Restkit)Sqlite数据库位于Core data 无法使用RestKit 0.2定位sqlite数据库,core-data,restkit,restkit-0.20,Core Data,Restkit,Restkit 0.20,我在我的项目中使用RestKit 0.2和CoredData,但在我的项目中找不到sqlite数据库文件。通常(不带Restkit)Sqlite数据库位于 ~/Library/Application Support/iPhone Simulator/[SDK version]/Applications/[App GUID]/Documents 但在此路径上找不到项目的SQLITE数据库路径 我遵循RKGist示例,并使用该示例初始化了RKObjectManager。我正在使用下面的代码设置我的
~/Library/Application Support/iPhone Simulator/[SDK version]/Applications/[App GUID]/Documents
但在此路径上找不到项目的SQLITE数据库路径
我遵循RKGist示例,并使用该示例初始化了RKObjectManager。我正在使用下面的代码设置我的RKObjectManager
NSURL *modelURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"MyApp" ofType:@"momd"]];
// NOTE: Due to an iOS 5 bug, the managed object model returned is immutable.
NSManagedObjectModel *managedObjectModel = [[[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL] mutableCopy];
RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel];
// Initialize the Core Data stack
[managedObjectStore createPersistentStoreCoordinator];
NSError* error = nil;
NSPersistentStore __unused *persistentStore = [managedObjectStore addInMemoryPersistentStore:&error];
NSAssert(persistentStore, @"Failed to add persistent store: %@", error);
[managedObjectStore createManagedObjectContexts];
// Set the default store shared instance
[RKManagedObjectStore setDefaultStore:managedObjectStore];
// Configure the object manager
RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://69.164.209.214"]];
objectManager.managedObjectStore = managedObjectStore;
[RKObjectManager setSharedManager:objectManager];
我能够正确地将JSON数据从服务器映射到我的NSManagedObject实体
我不确定我的数据是否存储在数据库中,因为我找不到我的项目的SQLITE数据库文件
Thanx
问候,
tek3您正在使用AddInMemoryStantStore,因此没有要查找的SQLite文件。。。是否要使用addSQLitePersistentStoreAtPath:@是的,我已经找到了。我纠正了这一点,我的SQLITE数据库就在那里。谢谢你的回复,伙计。