• 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: Commandline Tool Help - NSDistantObject and NSConnection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Commandline Tool Help - NSDistantObject and NSConnection


  • Subject: Re: Commandline Tool Help - NSDistantObject and NSConnection
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 2 Nov 2009 22:04:19 -0800


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 (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Commandline Tool Help - NSDistantObject and NSConnection
      • From: "Adam R. Maxwell" <email@hidden>
References: 
 >Commandline Tool Help - NSDistantObject and NSConnection (From: aaron smith <email@hidden>)
 >Re: Commandline Tool Help - NSDistantObject and NSConnection (From: aaron smith <email@hidden>)

  • Prev by Date: Re: Unable to disassemble objc_assign_strongCast
  • Next by Date: Re: Unable to disassemble objc_assign_strongCast
  • Previous by thread: Re: Commandline Tool Help - NSDistantObject and NSConnection
  • Next by thread: Re: Commandline Tool Help - NSDistantObject and NSConnection
  • Index(es):
    • Date
    • Thread