Search code examples
iosmacosmdns

If NetService is deprecated, how should I do mDNS on macOS?


My applications have been pretty successful at using mDNS to advertise and discover services. However, I was looking up documentation and found that Apple has flagged their Bonjour classes as deprecated: https://developer.apple.com/documentation/foundation/bonjour I've been searching, but I haven't found any indication of what I should use instead. What framework am I supposed to use to do mDNS if Apple drops NetService and NetServiceBrowser some time in the future?


Solution

  • I think I've seen some post on the Apple developer forums mentioning this. They seem to be pushing folks towards Network Framework. It appears nw_listener_set_advertise_descriptor is the replacement. See: https://developer.apple.com/documentation/network/2976786-nw_listener_set_advertise_descri

    Update: Managed to locate one of the threads on the developer forums. See: https://developer.apple.com/forums/thread/682744