UDPClient always fails with unknownError
MrJanssen opened this issue · 6 comments
The following code always fails to send a UDP message,
with console output:
"Client failed to send message to server: unknownError"
let udpClient = UDPClient(address: "127.0.0.1", port: 12033)
switch udpClient.send(string: "Hello") {
case .success:
print("Client sent message to server.")
case .failure(let error):
print("Client failed to send message to server: \(error)")
}
udpClient.close()
Using Xcode 10.1 and Swift 4.2
macOS High Sierra 10.13.6
I just figured this out - in your project's Capabilities settings ensure that the App Sandbox Network in and out (client and server) are enabled. 👍
Using Xcode Version 10.1 (10B61)
Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
Target: x86_64-apple-darwin18.5.0
macOS Mojave 10.14.4 Beta (18E194d)
This helped me! Thanks!
Does it work only with paid developer program? I do not see App sandbox in my capabilities
@ilyamordasov I checked the quick help on Xcode and it says "The Capability library shows only the capabilities available to the target type and your program membership. If you are not a member of the Apple Developer Program, the capabilities you can add are limited".
This might be one of those.
https://developer.apple.com/documentation/xcode/adding_capabilities_to_your_app
@rustymyers that's no good for me. ok, thanks :)