NSNetService gotcha
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.