How to fix: A server with the specified hostname could not be found
Published on 10 Oct 2023
When you create a new macOS project and try to make a network request you will notice it won't work right away. Let's fix that!
Collect user feedback from your iOS and macOS app. Prioritize what features to build next based on user interest and votes.
When you try to make a network request you will see an error message in the console. Something like:
- A server with the specified hostname could not be found.
- networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at “/Library/Preferences/com.apple.networkd.plist”, please add an exception.
Select your blue project file in Xcode. Then on the right make sure you selected your project name under "Targets" and go to "Signing & Capabilities". Finally under App Sandbox check "Outgoing Connections".
That’s it! Run the app again and try your network request, it should work now.
I am happy you read my article and hope you found it useful! If you have any suggestions of any kind don't hesitate let me know. I’d love to hear from you!