Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin does not request Local Network Usage Permission in iOS 14 #92

Open
spragadheeshraj opened this issue Sep 25, 2020 · 6 comments
Open

Comments

@spragadheeshraj
Copy link

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

@CoDanny
Copy link

CoDanny commented Sep 30, 2020

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>

@jthrilly
Copy link

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>

@timephy
Copy link

timephy commented Nov 7, 2020

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

@coloz
Copy link

coloz commented Mar 12, 2021

the same error!
Thanks @CoDanny got the fix!

@travisBradfield
Copy link

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>NSBonjourServices</key> <array> <string>watch._tcp.</string> <string>register._tcp.</string> <string>unregister._tcp_</string> </array> <key>NSLocalNetworkUsageDescription</key> <string>Bonjour services</string>

@mgscox
Copy link

mgscox commented Feb 20, 2022

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 => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants