【发布时间】:2012-09-03 07:27:37
【问题描述】:
我已使用以下方法在我的 FBChat 应用程序中注销时删除了 Core Data 中存储的所有条目。
//delete persistance.......
if ([__persistentStoreCoordinator persistentStores] == nil)
return;
[self.managedObjectContext reset];
[self.managedObjectContext lock];
NSPersistentStore *store = [[self.persistentStoreCoordinator persistentStores] lastObject];
if (![self.persistentStoreCoordinator removePersistentStore:store error:&error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
// Delete file
if ([[NSFileManager defaultManager] fileExistsAtPath:store.URL.path]) {
if (![[NSFileManager defaultManager] removeItemAtPath:store.URL.path error:&error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
}
__persistentStoreCoordinator = nil;
__persistentStoreCoordinator = [self persistentStoreCoordinator];
[self.managedObjectContext unlock];
但是当我再次登录时,fetchcontroller 没有得到值。我在注销时设置了fetchcontroller=nil。 fetchcontroller 的委托方法在登录时被调用。
如果有人有想法,请帮助我。提前致谢
【问题讨论】:
标签: ios5 core-data xcode4.2 nsfetchrequest nsfetchedresultscontroller