• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: core data key/value observation failure - even more information
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: core data key/value observation failure - even more information


  • Subject: Re: core data key/value observation failure - even more information
  • From: "John R. Timmer" <email@hidden>
  • Date: Sun, 05 Nov 2006 15:08:44 -0500

By targeting the object with a delayed performSelector, i'm actually able to keep it around and responsive indefinitely. My interface now works, so this allows a workaround. But this is an ugly, ugly hack, and i'd prefer not to have to use it, so any suggestions as to what's going on would be great.

Cheers,
JT


On Nov 5, 2006, at 3:00 PM, John R. Timmer wrote:

I decided to code around this bug manually, by handing each managed object of this type a target to inform when a specific value was changed, instead of simply observing the value. As with the previous case, this worked perfectly for all objects except one. I've placed appropriate breakpoints in various methods to sort out what's going on, and have discovered that the same Core Data object winds up pointing to a different chunk of memory after a certain, undefined amount of time (details below). All the Core Data object identification information appears to remain the same

It's only one object that this happens to, and i can't for the life of me figure out why, or how to avoid this. Any suggestions are very, very welcomed

OBJECT WHEN FIRST PULLED OUT OF THE MANAGEDOBJECTCONTEXT
Printing description of aPref:
<jt_ViewAndPrintPref: 0x1687c370> (entity: viewAndPrintPref; id: 0x16836120 <x-coredata://688696E3-68D7-4E51-AB82-4F6E993E992E/ viewAndPrintPref/p207> ; data: {
bindToKey = nil;
columnPosition = 4;
columnSize = 48.59619140625;
printInList = 1;
showInTable = 0;
tableColumnID = active;
tableName = cageProperties;
theDisplayName = "Active";
})
(gdb) continue
Current language: auto; currently objective-c
2006-11-05 14:45:49.362 Mouse Manager[20597] should have registered


OBJECT WHEN ITS TARGET HAS REGISTERED
Printing description of self:
<jt_ViewAndPrintPref: 0x1687c370> (entity: viewAndPrintPref; id: 0x16836120 <x-coredata://688696E3-68D7-4E51-AB82-4F6E993E992E/ viewAndPrintPref/p207> ; data: {
bindToKey = nil;
columnPosition = 4;
columnSize = 48.59619140625;
printInList = 1;
showInTable = 0;
tableColumnID = active;
tableName = cageProperties;
theDisplayName = "Active";
})
(gdb) continue
2006-11-05 14:46:09.655 Mouse Manager[20597] received a target


OBJECT ONE SECOND LATER, USING TIMED SELECTOR
Printing description of self:
<jt_ViewAndPrintPref: 0x1687c370> (entity: viewAndPrintPref; id: 0x16836120 <x-coredata://688696E3-68D7-4E51-AB82-4F6E993E992E/ viewAndPrintPref/p207> ; data: {
bindToKey = nil;
columnPosition = 4;
columnSize = 48.59619140625;
printInList = 1;
showInTable = 0;
tableColumnID = active;
tableName = cageProperties;
theDisplayName = "Active";
})
(gdb) continue
2006-11-05 14:46:22.677 Mouse Manager[20597] received a target




OBJECT WHEN AN ACTUAL VALUE IS CHANGED - NOTE THE NEW ADDRESS IN MEMORY
Printing description of self:
<jt_ViewAndPrintPref: 0x168b63b0> (entity: viewAndPrintPref; id: 0x16836120 <x-coredata://688696E3-68D7-4E51-AB82-4F6E993E992E/ viewAndPrintPref/p207> ; data: {
bindToKey = nil;
columnPosition = 4;
columnSize = 48.59619140625;
printInList = 1;
showInTable = 0;
tableColumnID = active;
tableName = cageProperties;
theDisplayName = "Active";
})





On Nov 2, 2006, at 1:44 PM, John R. Timmer wrote:

I'd assumed I was hallucinating, but this bug has now bitten me in two separate projects. During an "awakeFromNib" method, i have the following code, which loops through a series of managed objects:
aPref = [prefArray objectAtIndex: loopCounter];
[aPref addObserver: self forKeyPath: @"showInTable" options: NSKeyValueObservingOptionNew context: NULL];
NSLog ( [aPref valueForKey: @"theDisplayName"] );


The callback for changes just looks like this:
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id) anObject change:(NSDictionary *)change context:(void *)context {
NSLog ( @"got a change notification" );
return;


The output of the run log is as follows:
2006-11-02 13:34:31.090 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.090 Mouse Manager[16164] Unique ID
2006-11-02 13:34:31.090 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.091 Mouse Manager[16164] Cage Name
2006-11-02 13:34:31.091 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.091 Mouse Manager[16164] Cage Location
2006-11-02 13:34:31.092 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.092 Mouse Manager[16164] Active
2006-11-02 13:34:31.092 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.092 Mouse Manager[16164] # of Mice
2006-11-02 13:34:31.093 Mouse Manager[16164] got a change notification
2006-11-02 13:34:31.093 Mouse Manager[16164] Mice


Which is all as it should be - one notification per object (presumably as they wake from fetch?). While using the app, however, changing one of these objects never triggers the notification (in this case, it's the object with "Active"). I cannot for the life of me figure out why, but i've seen the exact same behavior in a separate project.

I've searched the archives, but didn't come across this; if someone could help me out before I go insane, i'd appreciate it.

Cheers,

John




____________________________________ Science writer, Ars Technica (among other things) http://arstechnica.com/journals/science.ars



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40bellatlantic.net


This email sent to email@hidden

____________________________________ Science writer, Ars Technica (among other things) http://arstechnica.com/journals/science.ars




____________________________________ Science writer, Ars Technica (among other things) http://arstechnica.com/journals/science.ars



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >core data key/value observation failure (From: "John R. Timmer" <email@hidden>)
 >Re: core data key/value observation failure - more information (From: "John R. Timmer" <email@hidden>)

  • Prev by Date: Re: core data key/value observation failure - more information
  • Next by Date: Re: [NSCalendar currentCalendar] leak
  • Previous by thread: Re: core data key/value observation failure - more information
  • Next by thread: Binding NSPopUpButton to an NSArrayController
  • Index(es):
    • Date
    • Thread