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

Garbage Collection and NSNetService


  • Subject: Garbage Collection and NSNetService
  • From: August Trometer <email@hidden>
  • Date: Sun, 11 Nov 2007 11:37:07 -0500

Hello!

I'm trying to wrap my head around Garbage Collection, but I'm baffled by the behavior of some of my objects. For example, I am trying to publish a Bon Jour service. I have an object that does this, BJController. It is instantiated within the Nib and the service is published during awakeFromNib

In my .h file, I have:

@property (retain) NSNetService *service;

and in the .m file:

@synthesize service;


When I publish the service I use:


self.service = [[NSNetService alloc] initWithDomain:@"" type:@"_BJTest._tcp" name:@"Just a Test" port:5260];

[self.service setDelegate:self];
[self.service publish];



Now, as long as I keep Garbage Collection turned off, this works fine. When I turn it on, however, the service object seems to evaporate before the service is published, and my NSNetService delegate methods never get called at all.


I've been through the GC docs, and I'm assuming it's got something to do with a weak reference somewhere. But I can't seem to figure out where that would be.

Any ideas?

Thanks!

August
_______________________________________________

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: Garbage Collection and NSNetService
      • From: Jon Hess <email@hidden>
    • Re: Garbage Collection and NSNetService
      • From: mmalc crawford <email@hidden>
  • Prev by Date: Re: Global hotkey problem in Leopard
  • Next by Date: Re: Removing Application-Created Items
  • Previous by thread: Re: Removing Application-Created Items
  • Next by thread: Re: Garbage Collection and NSNetService
  • Index(es):
    • Date
    • Thread