Created
August 21, 2012 03:43
-
-
Save tatsuro-ueda/3411315 to your computer and use it in GitHub Desktop.
iOSからBonjourを見つけるためのコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser | |
didFindService:(NSNetService *)aNetService | |
moreComing:(BOOL)moreComing | |
{ | |
// HTTPサービスのうちCocoaHTTPServerという名前のサービスだけを探す | |
if (!_desktopServer && [aNetService.name isEqualToString:@"CocoaHTTPServer"]) { | |
_desktopServer = [[NSNetService alloc] initWithDomain:[aNetService domain] | |
type:[aNetService type] | |
name:[aNetService name]]; | |
[_desktopServer resolveWithTimeout:30]; | |
_desktopServer.delegate = self; | |
self.statusLabel.text = @"Resolving CocoaHTTPServer..."; | |
NSLog(@"%@", _desktopServer); | |
} | |
else { | |
NSLog(@"ignoring %@", aNetService); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment