enter code hereIn my Application I am using Sqlite as an externel data base. So, Please Reply.I am using Xcode finding defficult to communicate to the sqlite file and Managed Object Model..
enter code here
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (__persistentStoreCoordinator != nil)
{
return __persistentStoreCoordinator;
}
NSURL *storeURL=[[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"CoreDataBountyHunter.sqlite"];
NSError *error = nil;
__persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error])
{
//
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.
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
return __persistentStoreCoordinator;
}
Asked
Active
Viewed 272 times
-1

Arpit B Parekh
- 1,932
- 5
- 36
- 57
-
1This is not a question. What problems are you having? What have you tried? – Tom Harrington Jul 29 '11 at 15:57
1 Answers
1
Core Data is not intended to be used with an external SQLite database, unless you implement your own store. If an external database with predefined schema is what you need then don't try to fit Core Data into your solution. Instead use the standard C API to talk to your SQLite database.

PeyloW
- 36,742
- 12
- 80
- 99
-
Sir, You are right but, here there is a sample application which shows that "Core data is extremely useful to deal with Sqlite if you don't want to go in the detail of Sql" You just need to tell the core data what you want to do. So, Below I am presenting the Code of fetch request and Store Coordinator. – Arpit B Parekh Jul 30 '11 at 06:33
-
All the things are going good instead of this part I have an error and calling abort. – Arpit B Parekh Jul 30 '11 at 06:39