Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从 NSNetService 类中删除已发布的服务?
任何人都可以告诉我这样做吗?
或需要始终让我的设备名称唯一(如果我完成了多次发布)
在 RunLoop 上调度一个 NSNetService 实例,以便它可以通过 mDNSResponder 定期发布 Bonjour 服务,并且网络上的其他设备不断被告知该服务的存在。
只需从 RunLoop 中删除 NetService 就可以了。不要忘记调用 -stop 之前,以防您的 NetService 当前正在尝试发布。