NsNetServiceBrowser finding unpublished services

I am developing a 3D Wi-Fi multiplayer (on common Wi-Fi network) game for iPhone and iPad without using any game engine. I am using Bonjour to publish and find nearby services. The game shows list of services available for connection.


Currently, NsNetServiceBrowser is even finding services which are already unpublished. During debugging I found that “didRemoveService” function of NsNetServiceBrowser’s delegate is not called when service is unpublished and as a result of this service name still appears on the list.

The above issue only happens on physical devices and not on simulators. On simulator, the list immediately updates when any service becomes unavailable.

I have the following questions:

  1. Are there any performance issues with NsNetServiceBrowser?
  2. Are there any coding changes required so that “didRemoveService” function is called immediately when service is unpublished?

I’d appreciate any suggestions on this issue. Thank you in advance.

Can you reproduce this on the current iOS 9 beta?

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I have tested my game on iOS 7 and iOS 8. I am facing this issue on both the OS. Is this issue is fixed with iOS 9?

I am experiencing the same issue on all iOS versions up to iOS 12. It only reproduces when the devices are connected to a router (I am using the "local." domain), When they are not connected to a router, everything works as expected.

NsNetServiceBrowser finding unpublished services
 
 
Q