0
다음과 같은 방법을 사용하여 FBChat 응용 프로그램에서 로그 아웃 할 때 핵심 데이터에 저장된 모든 항목을 삭제했습니다.fetchcontroller facebook chat 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
차가워졌습니다. up-vote 또는 answer accept는 훌륭합니다. – Mundi