문제

I have an NSPersistentDocument. When I use the default managedObjectContext, it behaves as expected: the window shows the document is "edited" when new objects are added, and when I exit new, untitled, documents, the "save as" sheet appears.

When I replace the default managedObjectContext with one of my own creation (a private queue), however, all of these behaviors disappear. The document does not appear to recognize when edits to the document are made, and new, untitled, documents just close without the "save as" sheet appearing. This is all despite the fact that [managedObjectContext hasChanges] == YES.

Any ideas would be greatly appreciated.

도움이 되었습니까?

해결책

I figured it out: I was not setting the document's undoManager to that of my custom managedObjectContext. Now things work as expected.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top