Re: NSData as value in NSManagedObject

2010-02-20 Thread Mikkel Eide Eriksen
Heh, it actually works currently though. That is a straight copy from my running code. Oh, I get it now! selectedObjects is obviously an array, so when I send valueForKey:@"xml" to it, I get an array of the results of that call on each element - thus requiring lastObject. So really the la

Re: NSData as value in NSManagedObject

2010-02-20 Thread Alexander Spohr
Am 20.02.2010 um 16:29 schrieb Mikkel Eide Eriksen: > NSData *xmlData = (NSData *)[[[treeController selectedObjects] > valueForKey:@"xml"] lastObject]; //HERE'S THE PROBLEM Well, yes. You ask your xml for lastObject. That won’t work. What you want is this: [[[treeController selectedObjec

Re: NSData as value in NSManagedObject

2010-02-20 Thread Mikkel Eide Eriksen
Hi Jerry Thanks for the reply, here are the methods in question. Bear in mind I'm still new to Core Data so there are probably some grievous things going on (the project is GC, by the way). addXML:toBucket:atPath: gets called when self receives new XML. I choose from the added XML via an

NSData as value in NSManagedObject

2010-02-19 Thread Mikkel Eriksen
I've put a small NSXMLDocument into a Core Data binary property like this: code: NSManagedObject *object = /* ... */ NSXMLDocument *xmlDoc = /* ... */ [object setValue:[xmlDoc XMLData] forKey:@"xml"]; When I go to retrieve it, it's wrapped in an array: (gdb) print-object