Open spragadheeshraj opened 3 years ago
This actually can be fixed with no changes to this plugin. Simply add this to your info.plist
<key>NSBonjourServices</key>
<array>
<string>my_service._tcp.</string>
<string>my_other_service._tcp.</string>
</array>
<key>NSLocalNetworkUsageDescription</key>
<string>Describe why you want to use local network discovery here</string>
For those wanting a way to script this, you can add the following to your config.xml
:
<config-file parent="NSBonjourServices" target="*-Info.plist">
<array>
<string>_my_service._tcp.</string>
</array>
</config-file>
<config-file parent="NSLocalNetworkUsageDescription" target="*-Info.plist">
<string>My service description.</string>
</config-file>
Having the same struggle. Thanks @CoDanny got the fix!
Would be nice if this issue was documented. Finding this over google was not 100% intuitive.
Thank you for the library!
=======
Ionic: Ionic CLI : 6.12.1 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.3.5 @angular-devkit/build-angular : 0.901.12 @angular-devkit/schematics : 9.1.12 @angular/cli : 9.1.12 @ionic/angular-toolkit : 2.3.3
Capacitor: Capacitor CLI : 2.4.2 @capacitor/core : 2.4.2
@ionic-native/zeroconf@5.28.0 cordova-plugin-zeroconf@1.4.2
the same error! Thanks @CoDanny got the fix!
Hello,
I'm battling with this issue at the moment. Please can you share the chunk from your info.plist? Mine looks like this at the moment and is not working:
`
<key>NSLocalNetworkUsageDescription</key>
<string>Bonjour services</string>`
Hi, Adding the entry to plist did not solve it for me, I had to make a slight adjusment - take note of the "dot" after _tcp in each entry, after finding comment on Apple Developer site https://developer.apple.com/forums/thread/653316?answerId=676938022#676938022
plist
<key>NSBonjourServices</key>
<array>
<string>_myservice._tcp</string>
</array>
<key>NSLocalNetworkUsageDescription</key>
<string>Locate server using local network discovery</string>
code
Zeroconf.watch('_myservice._tcp.', 'local.').subscribe(result => {
cordova-plugin-zeroconf version 1.4.2 There is no response from .watch() method Even if the local network is enabled through some other means, the plugin calls the error callback with "null"
Platform info Cordova version 9.0.0 Cordova-ios 5.1.1 Uses WKWebview XCode 12.0.1 Ionic version 1.3.1