On Nov 2, 2009, at 9:36 PM, aaron smith wrote:

There seems to be some kind of bug when passing around an NSURL through
distributed objects.

Oh, you've run into _that_! :-/

For some reason, NSURLs are unexpectedly not copied when sent over DO, the way other "value" objects like NSStrings and NSNumbers are. They're sent by reference, so what you get on the receiving end is a proxy object. This causes two problems: (1) Performance sucks because every time you access that NSURL, like getting its path or comparing it with another URL, it has to send a message over the wire to the other process and back. (2) After you close the connection, that proxy object doesn't work anymore and will throw exceptions when you try to use it.

Sounds like you had trouble with (2).

This misfeature has confused a lot of people over the years, including me. My solution, once I found out what was going on, was to never send NSURLs over DO — I converted them to NSStrings on the sending side and back to NSURLs on the receiving.

—Jens_______________________________________________

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