• 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
NSNetService gotcha
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSNetService gotcha


  • Subject: NSNetService gotcha
  • From: Chris Hanson <email@hidden>
  • Date: Sat, 18 Jan 2003 14:36:12 -0600

(Cross-posting from my weblog <http://www.livejournal.com/users/chanson/> in hopes of saving people some debugging time.)

If you're using NSNetService to publish a service via Rendezvous, don't use the following code to stop the service:

[myService stop];
[myService release];
myService = nil;

You'll fail miserably with a bus error inside of Rendezvous, with no direct evidence why it happened.

It turns out that there's teardown that's still happening after -stop returns. So you need to set a delegate for your service, and release & nil out the service in the delegate method -netServiceDidStop:.

The PictureSharing sample does, of course do it the right way. I was just skimming the documentation and coding away...

-- Chris

--
Chris Hanson, bDistributed.com, Inc. | Email: email@hidden
Custom Application Development | Phone: +1-847-372-3955
http://bdistributed.com/ | Fax: +1-847-589-3738
http://bdistributed.com/Articles/ | Personal Email: email@hidden
_______________________________________________
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.

  • Prev by Date: Re: NSWindow
  • Next by Date: Re: Get IP address and info from FileHandle
  • Previous by thread: Re: Get IP address and info from FileHandle
  • Next by thread: NSWorkspace fullPathForApplication: not thread safe?
  • Index(es):
    • Date
    • Thread