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

About iOS 14 Local Network Privacy #726

Closed
0x5e opened this issue Jul 3, 2020 · 6 comments
Closed

About iOS 14 Local Network Privacy #726

0x5e opened this issue Jul 3, 2020 · 6 comments

Comments

@0x5e
Copy link

0x5e commented Jul 3, 2020

Any discussion about this? There's API for URLSession and NWConnection to block the request until user click the allow button, but socket can't handle this. And there's no API to get permission status before the request.

https://developer.apple.com/videos/play/wwdc2020/10110/
https://developer.apple.com/forums/tags/wwdc20-10110

@scinfu
Copy link

scinfu commented Aug 25, 2020

I Have same problem.
There is solution?

@calrsom
Copy link

calrsom commented Oct 13, 2020

We use this library as part of a Cordova native sockets library for an iOT iPad application. We explored several options for supporting iOS 14 before landing on implementing a bogus Bonjour service query to trigger the local network permission dialog. Once the local network permission is given, the entire app can access networking features as usual, including this library. This is our short-term workaround that let us get a fix for our app into the app store.

Longer term, I hope Apple adds an API for managing and requesting this permission. That would allow older libraries like this to still work. Until then, the only other option is to add/move to a newer networking API that supports the permission on iOS 14+.

@bitcrumb
Copy link

This thread on the Apple forum contains extremely helpful information regarding the new Local Network Privacy in iOS 14. It should answer most, if not all of your questions 👍
https://developer.apple.com/forums/thread/663858

@0x5e
Copy link
Author

0x5e commented Oct 15, 2020

There's a lot of complains in Apple forum about why there's no api to get permission status of localnetwork, but apple developer insists that they will not provide it. I think your long-term plan won't work :( @calrsom

I would like to share my workaround:

  1. When mobile is connected to wifi.
  2. Get local ip of your mobile using getifaddrs api. (Maybe there's a little risk)
  3. Send a http request to your local ip using NSURLSession, any url path is okay. (e.g. http://{your_local_ip}/trigger-local-network-authorization)
  4. the permission alert will be shown.
  5. Of course the request failed, but we can differ from the error.code. NSURLErrorNotConnectedToInternet means permission not open (local network request has been blocked), else means opened.

@github-actions
Copy link

This issue has been marked as stale, it will be closed automatically if there is no further activity.

@bitcrumb
Copy link

AFAIK, at this moment in time the only thing you are required to provide is the NSLocalNetworkUsageDescription description in your Info.plist.

Since CocoaAsynSocket using BSD sockets, there is no need (and enforcement of) the com.apple.developer.networking.multicast entitlement yet.

However, it is highly encourages to do so, since the expectation is that this will become required with one of the iOS 14.x maintenance updates, see discussion at: https://developer.apple.com/forums/thread/655920.

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

No branches or pull requests

4 participants