objective c - iOS Bonjour not removing service when stopped -
i using bonjour ios application. when use
[self.netservice stop];
service not stop publishing. when turn off wifi
- (void)netservicebrowser:(nsnetservicebrowser *) servicebrowser didremoveservice:(nsnetservice *) service morecoming:(bool) morecoming
this method not getting called. wifi turn off want event bonjour can stop other things in app. 1 have solution this. in advance.
service not stop publishing.
you can try following:
[self.netservice stop]; [self.netservice removefromrunloop:[nsrunloop currentrunloop] formode:nsrunloopcommonmodes]; self.netservice = nil;
calling stop
method should invoke delegate method netservicedidstop
, can implement see if gets called on stopping.
for wifi turn off want event bonjour can stop other things in app.
there seems no programmatic event detect when wifi disabled or enabled, it's not possible detect if wifi enabled or not. try check reachability of internet in loop detect when device offline. in this question can find examples how check reachability.
see also:
Comments
Post a Comment