ios - How to check if NSNetService has stopped publishing -
i need find way observe when app stops publishing service via bonjour. happens when device receives call or such interruption.
background:
i'm using gcdasyncsocket communicate between 2 devices in same network app plays music (supports playback in background).
i use nsnetservice broadcast ip , port other apps (clients) connect server.
when server device receives phone call, publishing stops , other devices won't able see service.
is there particular property need observe know when has stopped , can restart again.
thanks in advance
older question, i'm facing same problem currently.
as far know can following:
you can use nsnetservicebrowser
, nsnetservicebrowserdelegate
delegate.
i assume you're using nsnetservicebrowser
class, with
[self.domainbrowser searchforservicesoftype:@"youridentifier" indomain:@"local."];
you can set delegate on browser instance.
the delegate method - (void)netservicebrowser:(nsnetservicebrowser *)anetservicebrowser didremoveservice:(nsnetservice *)anetservice morecoming:(bool)morecoming
called when nsnetservice disappeared.
you can implement method , needed operations.
Comments
Post a Comment