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 lastObject can go either place. Thanks!

Mikkel

On 20/02/2010, at 16.54, Alexander Spohr wrote:


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 selectedObjects] lastObject] valueForKey:@"xml"]

Ask the array for its lastObject, then get the xml out of it ;)

        atze


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to