• 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: 'encodeWithCoder:]: Selector Not Recognized' (Bingo!)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data: 'encodeWithCoder:]: Selector Not Recognized' (Bingo!)


  • Subject: Re: Core Data: 'encodeWithCoder:]: Selector Not Recognized' (Bingo!)
  • From: "Frederick C. Lee" <email@hidden>
  • Date: Wed, 5 Apr 2006 15:48:47 -0700

I looked at the 'saveMemo' method of EntityManagedObject.

- (void)saveMemo {
NSAttributedString *memo = [self primitiveValueForKey:@"memo"];
if (memo != nil) {
[self setPrimitiveValue:[NSArchiver archivedDataWithRootObject:memo]
forKey:@"memoData"];
}
else {
[self setPrimitiveValue:nil forKey:@"memoData"];
}
} // end saveMemo().


What's in 'memo'?   Should be a NSAttributedString object.
But instead, I got the 'MapCoordinates' object!!

(gdb) po memo
<MapManagedObject: 0x3d01410> (entity: MapCoordinates; id: 0x637290 <x-coredata:///MapCoordinates/t26B85555-7F11-4D53-98E7- F0CCDE2B960C> ; data: {
coordString = "{292, 85}";
map = 0x38d4cc0 <x-coredata://0CC53C8C-C0A3-44BA-8291- B9ADD8C48B8F/Map/p2>;
name = One;
})


=========================================

So now I know the CAUSE of the failure.

But how/why was 'MapCoordinates' (NSManagedObject) stored in
the primitive 'memo' (NSAttributedString attribute)?

--- Another mystery!


Ric.



I did as you suggest:

// MapManagedObject.m:

- (void)encodeWithCoder:(NSCoder *)aCoder {
    NSLog(@"MapManagedObject.m {encodeWithCoder}");  <-- GDB BREAK
}

- (void)willSave {
    [super willSave];
}
=================================================================
(gdb) list
13	    return NSApplicationMain(argc,  (const char **) arew);
14	}

#0 0x0008fc60 in -[MapManagedObject encodeWithCoder:] at MapManagedObject.m:98
#1 0x929db584 in -[NSArchiver encodeRootObject:]
#2 0x929db490 in +[NSArchiver archivedDataWithRootObject:]
#3 0x000c0c24 in -[EntityManagedObject saveMemo] at EntityManagedObject.m:110 <-- check here
#4 0x000c0ce0 in -[EntityManagedObject willSave] at EntityManagedObject.m:121
#5 0x0008fcf0 in -[MapManagedObject willSave] at MapManagedObject.m: 114


It appears to be started at the saveMemo: <-- which is a NSAttributedString value.


_______________________________________________
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: adding a child data element, saving... 'encodeWithCoder:]: Selector Not Recognized' (with clue) (From: "Frederick C. Lee" <email@hidden>)
 >Re: Core Data: adding a child data element, saving... 'encodeWithCoder:]: Selector Not Recognized' (with clue) (From: Chris Hanson <email@hidden>)

  • Prev by Date: Re: documentation path?
  • Next by Date: Re: UI Opinions, etc
  • Previous by thread: Re: Core Data: adding a child data element, saving... 'encodeWithCoder:]: Selector Not Recognized'
  • Next by thread: custom view for NSTabViewItem
  • Index(es):
    • Date
    • Thread