0

Performing the following in my app won't call the delegate:

NSNetService * bonjourMonitor;
    bonjourMonitor = [[NSNetService alloc] initWithDomain:@"local." type:@"_device-info._tcp" name:@"My Mac"];
    [bonjourMonitor setDelegate:self];
    [bonjourMonitor startMonitoring];

I am using Automatic Reference Counting. Doing the same without ARC works perfect. NSNetService seams to be released before the delegate has been called.

How can I prevent this from happening?

Thanks a lot!

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Daniel
  • 1,473
  • 3
  • 33
  • 63

1 Answers1

1

Define bonjourMonitor as an ivar or static.

Christian Beer
  • 2,027
  • 15
  • 13