Note that there are some explanatory texts on larger screens.

plurals
  1. PONSNetServiceBrowser did NOT find published service
    text
    copied!<p>On an iPhone (the server), I've tried to publish a service and my code ran into the <code>NSNetService</code> object's delegate method:</p> <pre><code>-(void)netServiceDidPublish:(NSNetService *)sender </code></pre> <p>So I believe that my service <code>@"_chatty._tcp."</code> has published successfully. Then on another iPhone (the client), I use <code>NSNetServiceBrowser</code> to find my service, but it did NOT run into the delegate method:</p> <pre><code>-(void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindService:(NSNetService *)netService moreComing:(BOOL)moreServicesComing </code></pre> <p>I found some questions related to my case on this site, most of the answer remind to check the delegate object whether is out of scope or not. I'm sure my delegate work well because it ran into another delegate method like:</p> <pre><code>-(void)netServiceBrowserWillSearch:(NSNetServiceBrowser *)aNetServiceBrowser </code></pre> <p>Can anybody help me find out the reason?</p> <p>Here are some parts of my code:</p> <p>I init the service like that:</p> <pre><code>#define MY_PROTOCOL @"_chatty._tcp." self.myService = [[NSNetService alloc] initWithDomain:@"" type:MY_PROTOCOL name:@"thaith" port:self.port]; </code></pre> <p>The port is initialized with a given listeningSocket in the Browser class:</p> <pre><code>NSNetServiceBrowser* finder = [[NSNetServiceBrowser alloc] init]; //I also retain the finder. finder.delegate = self; [finder searchForServicesOfType:MY_PROTOCOL inDomain:@""]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload