In my opinion, you REALLY need to add an API where developers can query the status of the Local Network permission. Otherwise it is near impossible to make a good user experience, particularly considering that the access can be revoked at a later time. NSURLSession only returns the error code -1009 "The Internet connection appears to be offline.”, and if that occurs, how should we handle that?
Also, your logic now assumes that permission should be granted at the time the request is sent, but what if you need to ask for permission in advance? For example, let’s say an app needs to send a WakeOnLan packet to a LAN device, not now, but at a later time, how should the app handle that?
As an example, our application uses Bluetooth LE to communicate with sensors and when those sensors are triggered the app is then woken up (In the background) to forwards commands to Smart Home devices on the LAN (such as Philips Hue lights). Since this happens in the background iOS will not display a permission dialog, so the user will not be able to allow permission. The app will not know, at this time, if the request failed due to lack of permission or if the iOS device is not connected to the LAN.
We can not be expected to always display an error notification saying “You either have no internet connection or you don’t have Local Network permission.”. That would be a terrible user experience!
Lastly, the fact that you do have the option to both ask for, and check, permissions on other API’s clearly shows that Apple knows that it is needed. Just look at AVCaptureSession and CLLocationManager.
Post
Replies
Boosts
Views
Activity
I can confirm that I have noticed the same thing.
I too have noticed one core running constantly at 100% while running Xcode 15.3 and iOS 17.4. Although I'm not using SwiftData.
Anyhow, I've noticed that I can bypass this issue by disabling both Main Thread Checker and Thread Performance Checker in the Scheme's Run target Diagnostics tab.
Just in case it helps anyone out.