0
我已经删除了在我的FBChat应用程序注销时通过使用下面的方法存储在核心数据中的所有条目。fetchcontroller没有获得价值在facebook聊天ios应用程序
//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
的代理方法在登录时被调用。
如果有人有想法,那么请帮助我。在此先感谢
谢谢你的回答。我用另一种方法清除核心数据。现在它工作正常 – Anand
很酷。投票或回答接受会很好。 – Mundi