NSNetServiceBrowser is deprecated, but no replacement

I saw NSNetServiceBrowser is marked as deprecated on Apple document. But I cannot see replacement of this class.

I need to write mDNS finder program. Should I use NSNetServiceBrowser or another class?

Replies

In the the vast majority of cases you can replace NSNetServiceBrowser with NWBrowser (or, if you’re using a C-based language, nw_browser_t). There are a few specialist situations where you’ll need to drop down to <dns_sd.h>.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Well - not everyone wants to use Swift - why no Objective-C implementation? (Well I will have to use nw_browser_t then)

not everyone wants to use Swift

Indeed. Fortunately Objective-C is very good at using C APIs like this. Network framework is much like Dispatch in that regard.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"