• 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: DO: setRootObject
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DO: setRootObject


  • Subject: Re: DO: setRootObject
  • From: Wade Tregaskis <email@hidden>
  • Date: Tue, 7 Oct 2003 22:03:06 +1000

I would like to call setRootObject throughout the duration of a an NSConnection because I hope to vend multiple objects through a single proxy. Apple Docs say:

"This only affects new connection requests and rootProxy messages to established NSConnections; applications that have proxies to the old root object can still send messages through it."

Does this mean the client thread has to create a new connection every time it wants to "switch" the object it is referring to? If so, can I solve this inefficiency by creating a proxy for the proxy?

Not necessarily. I believe what it's saying is that if you have a client which has your first root object, it will still refer to that object even if you change the root object. However, any future connections to that connection will see the new root object. I don't think there's anything explicitly stopping your existing connections from obtaining the new root object.

If you want to change root objects for existing connections, two easy ways spring to mind - have the existing root object send the new one to a delegate or similar on the client side, or have the client call NSConnection's "rootProxy" method at appropriate intervals to see if a new one is available. The latter is simpler, of course, but standard polling disclaimer applies, i.e. inefficient.

Your first comment has me a bit confused though - do you really mean "proxy", or "connection"? If the latter, then you should know that you can of course vend an unlimited number of objects through any one NSConnection. You can only have one root object a time, that's all. You could make the root object a dictionary or array, listing all your available objects, for example.

Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >DO: setRootObject (From: AgentM <email@hidden>)

  • Prev by Date: Re: Plugin Framework
  • Next by Date: Re: different launch methods
  • Previous by thread: DO: setRootObject
  • Next by thread: WebKit/Java Applet problem
  • Index(es):
    • Date
    • Thread