0

So I made the App with a Android Device in the development Process and everything worked fine like it should. Then I tried building it for IOS and nothing worked I just got a white screen. So I made a test app which just the ZeroConf Plugin in it and fetching something completely simple.

zeroconf.watch('_scanassist._tcp.', 'local.').subscribe(result => {
   console.log('SOMETHING WAS FOUND!')
   alert('SOMETHING WAS FOUND')
 });

Just tested it on Android and everything worked like usually but when on IOS it does not. I execute this code in the constructor on my main page, could that be the problem? After that I put it in a setTimeout and the side loaded but Zeroconf did not give me an alert even it should give me one.

Link to Ionic Native Page: https://ionicframework.com/docs/native/zeroconf/

Yonathan
  • 1
  • 3

1 Answers1

1

I've not used Ionic ZeroConf but have had quite a few issues with https://github.com/balthazar/react-native-zeroconf and ios.

We were unable to discover MDNS services on iOS with react-native-zeroconf, however, after performing a scan via Fing (iOS app) we were able to discover and resolve successfully again with react-native-zeroconf.

I suspect this has something to do with the way ios caches MDNS records. ZeroConf does not seem to be able to flush outdated MDNS records on scan.

We ended up ditching ZeroConf on ios because it was notoriously unreliable and instead used customed .local address for ios.

We are still using ZeroConf on Android without issue.

Laurie Williams
  • 383
  • 2
  • 8
  • Thanks for this awesome answer! But what do you mean by custom .local dresses and how could I implement it in my app? – Yonathan Nov 22 '18 at 17:16
  • You're welcome. Well, we have our own iot devices which broadcast as custom service but you can use any .local address on your network. If you can find the name of the service you're trying to connect to, you can return it as a .local address. For example, My-MacBook-Pro.local should resolve to the IP address to something like 192.168.88.206 on ios. So instead of running the scan with ZeroConf, you just return ( MYDEVICENAME.local:1884 ) Hope that helps. – Laurie Williams Nov 22 '18 at 17:46
  • Thanks for the answer again. For some strange reason the Libary on the other end (https://www.npmjs.com/package/bonjour) did not support mDns which will be used on IOS and not on Android so that was the key difference between them. So I switched to mDns(https://www.npmjs.com/package/mdns) for IOS – Yonathan Nov 22 '18 at 20:26
  • @LaurieWilliams - can you share the code please for android.. I am trying it from days but same doesnt work for me... My IOT device address is `testing.local` but zeroconf is unable to scan it :( – Varun Sep 25 '21 at 16:25