Я ныряя в развитие iPhone, поэтому я заранее извиняюсь, если это смешной вопрос, но в новом приложении проекта IPad с использованием базы данных ядра, вот сгенерированный код для создания persistentStoreCoordinator ...Где я могу найти постоянное хранилище основных данных iPhone приложения?
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
if (persistentStoreCoordinator != nil) {
return persistentStoreCoordinator;
}
NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"ApplicationName.sqlite"]];
NSError *error = nil;
persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:nil error:&error]) {
/*
Replace this implementation with code to handle the error appropriately.
abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button.
Typical reasons for an error here include:
* The persistent store is not accessible
* The schema for the persistent store is incompatible with current managed object model
Check the error message to determine what the actual problem was.
*/
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
return persistentStoreCoordinator;
}
Мои вопросы ...
- Первый раз, когда я запустить приложение, это база данных ApplicationName.sqllite создается автоматически, если она не существует? Если нет, то когда он создан? Когда данные добавляются к нему программно?
- Как только база данных существует, где я могу найти файл? Я хотел бы открыть его с помощью другой программы, чтобы я мог вручную манипулировать данными.
Заранее благодарим за помощь! Я собираюсь продолжить изучение этих вопросов прямо сейчас.
Спасибо, Брэд, ты был огромной помощью весь день! – BeachRunnerFred