简体   繁体   English

我们如何从 NSNetService class 中删除已发布的服务?

[英]how we remove a published service from NSNetService class?

how can i remove a published service from NSNetService class?如何从 NSNetService class 中删除已发布的服务?

can any one tell me to do it?任何人都可以告诉我这样做吗?

or need to get my device name unique at all times(if i done more than one publish)或需要始终让我的设备名称唯一(如果我完成了多次发布)

An NSNetService instance is scheduled on the RunLoop so that it can regularly publish the Bonjour service via the mDNSResponder and that other devices on the network keep being informed the service exists.在 RunLoop 上调度一个 NSNetService 实例,以便它可以通过 mDNSResponder 定期发布 Bonjour 服务,并且网络上的其他设备会不断被告知该服务的存在。

Simply remove the NetService from your RunLoop should do the trick.只需从 RunLoop 中删除 NetService 就可以了。 Don't forget to call -stop before, in case your NetService is currently trying to publish.不要忘记调用 -stop 之前,以防您的 NetService 当前正在尝试发布。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM