无法使用RestKit 0.2找到sqlite数据库

时间:2013-05-31 06:28:30

标签: 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。我使用下面的代码来设置我的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数据库文件。

感谢名单,

此致

tek3

0 个答案:

没有答案