Re: Invalidated managed objects
Re: Invalidated managed objects
- Subject: Re: Invalidated managed objects
- From: Ben Trumbull <email@hidden>
- Date: Sat, 3 Apr 2010 18:22:35 -0700
On Apr 3, 2010, at 5:07 PM, Gideon King wrote:
> Wow, this is huge! Obviously the user doesn't expect the document to disappear and a new one open up just because they did a Save As operation
I have I'm afraid led you astray. The invalidated objects are not coming from the Save As operation. The managed objects in the MOC bound to the NSPersistentDocument, and any other MOCs bound to that same PSC will keep the NSManagedObjects themselves in sync with the underlying document even as it is remapped to a new file. I'll send you a sample project from the template that logs the notifications from NSManagedObjectContext and NSPersistentStoreCoordinator. The NSManagedObject pointers remain undisturbed.
2010-04-03 18:13:41.110 testDocs[14260:a0f] PSC changed: {
changedUUID = (
"<NSSQLCore: 0x1025513e0>",
"<NSSQLCore: 0x103051890>",
(
"0x1025a4bc0 <x-coredata://7401BACF-50F9-4699-8B65-520963A9B084/Entity/p3>",
"0x103055bc0 <x-coredata://9D960070-9CAE-4BDD-9EDF-99ACCD83AF7F/Entity/p1>",
"0x102504fb0 <x-coredata://7401BACF-50F9-4699-8B65-520963A9B084/Entity/p2>",
"0x103051d40 <x-coredata://9D960070-9CAE-4BDD-9EDF-99ACCD83AF7F/Entity/p3>",
"0x102598810 <x-coredata://7401BACF-50F9-4699-8B65-520963A9B084/Entity/p1>",
"0x1004eeb10 <x-coredata://9D960070-9CAE-4BDD-9EDF-99ACCD83AF7F/Entity/p2>"
)
);
}
2010-04-03 18:13:41.112 testDocs[14260:a0f] PSC changed. Registered objects = {(
<NSManagedObject: 0x1004db090> (entity: Entity; id: 0x103051d40 <x-coredata://9D960070-9CAE-4BDD-9EDF-99ACCD83AF7F/Entity/p3> ; data: {
name = baz;
}),
<NSManagedObject: 0x1004db120> (entity: Entity; id: 0x103055bc0 <x-coredata://9D960070-9CAE-4BDD-9EDF-99ACCD83AF7F/Entity/p1> ; data: {
name = foo;
}),
<NSManagedObject: 0x1004daea0> (entity: Entity; id: 0x1004eeb10 <x-coredata://9D960070-9CAE-4BDD-9EDF-99ACCD83AF7F/Entity/p2> ; data: {
name = zap;
})
)}
2010-04-03 18:13:53.604 testDocs[14260:a0f] PSC changed: {
changedUUID = (
"<NSSQLCore: 0x103051890>",
"<NSSQLCore: 0x103062860>",
(
"0x10305b680 <x-coredata://9D960070-9CAE-4BDD-9EDF-99ACCD83AF7F/Entity/p1>",
"0x10306a890 <x-coredata://381F89A2-9204-45E8-850B-1CED8022E32E/Entity/p1>",
"0x10305b3c0 <x-coredata://9D960070-9CAE-4BDD-9EDF-99ACCD83AF7F/Entity/p2>",
"0x10306aa80 <x-coredata://381F89A2-9204-45E8-850B-1CED8022E32E/Entity/p2>",
"0x1030681e0 <x-coredata://9D960070-9CAE-4BDD-9EDF-99ACCD83AF7F/Entity/p3>",
"0x10306ae20 <x-coredata://381F89A2-9204-45E8-850B-1CED8022E32E/Entity/p3>"
)
);
}
2010-04-03 18:13:53.604 testDocs[14260:a0f] PSC changed. Registered objects = {(
<NSManagedObject: 0x1004db090> (entity: Entity; id: 0x10306ae20 <x-coredata://381F89A2-9204-45E8-850B-1CED8022E32E/Entity/p3> ; data: {
name = baz;
}),
<NSManagedObject: 0x1004db120> (entity: Entity; id: 0x10306a890 <x-coredata://381F89A2-9204-45E8-850B-1CED8022E32E/Entity/p1> ; data: {
name = foo;
}),
<NSManagedObject: 0x1004daea0> (entity: Entity; id: 0x10306aa80 <x-coredata://381F89A2-9204-45E8-850B-1CED8022E32E/Entity/p2> ; data: {
name = zap;
})
)}
There are no invalidate managed objects if you create a Core Data document based app from the Xcode template and then perform Save As. I'll take another look at your sample project.
- Ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden