0
내가 이런 temporaryContext 만들 :임시 컨텍스트에서 변경 사항을 롤백하는 방법은 무엇입니까?
let temporaryContext = NSManagedObjectContext(concurrencyType: .PrivateQueueConcurrencyType)
temporaryContext.parentContext = Utility.managedObjectContext()
temporaryContext.performBlockAndWait({
// .. here I have done some changes on temporaryContext
let success = temporaryContext.save(nil)
//GUI get updated, GUI use MAIN context
})
내가 변경을 롤백 할를, 그래서이 수행
temporaryContext.performBlockAndWait({
temporaryContext.rollback()
let success = temporaryContext.save(nil)
//GUI not get restored to the default variable
})
을하지만 아무런 영향을 미치지 않습니다, 부모의 문맥이 롤백되지 않습니다, 왜?
"상태가 변경된 상태에 머물러있다"는 것이 무슨 뜻인지 잘 모르겠습니다. 첫 번째'temporaryContext.save (nil)'호출과'temporaryContext.rollback()'사이에 어떤 변경을 했습니까? 그렇다면,'rollback'을 호출 한 후에 이러한 변경 사항들이 관리 객체에 남아 있습니까? –
변경 사항이 없습니다. 부모 컨텍스트가 롤백되지 않습니다. –