samedi 14 février 2015

iOS 8 Can't locate sqlite File When using CoreData

I was using my iPhone to run the project. here is my Code:



NSPersistentStoreCoordinator *persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model];

NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *dataStorePath = [documentPath stringByAppendingPathComponent:@"NewsData.sqlite"];
NSURL *dataStoreURL = [NSURL fileURLWithPath:dataStorePath];

BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:dataStorePath];
NSLog(@"%@",fileExists);
sqlite3 *db;
if (sqlite3_open([dataStorePath UTF8String], &db) != SQLITE_OK) {
sqlite3_close(db);

}


the Bool Type 'fileExists' is true,but when i use Finder to locate the sqlite file,it doesn't work. Anybody can help me ? thanks in advance.


Aucun commentaire:

Enregistrer un commentaire