Error while calling NWListener in xcode 10.1

I have xcode 10.1 and using mac os development target 10.14

While calling the below line it is giving following error
listener = try! NWListener(using: .tcp, on: self.port)

dyld: lazy symbol binding failed: Symbol not found: nwtcpcreateoptions
 Referenced from: /Users/radhika/Library/Developer/Xcode/DerivedData/test2-dizzlvivbbforkeiqgrkxldrweer/Build/Products/Debug/test2 (which was built for Mac OS X 10.14)
 Expected in: /usr/lib/libnetwork.dylib

dyld: Symbol not found: nwtcpcreateoptions
 Referenced from: /Users/radhika/Library/Developer/Xcode/DerivedData/test2-dizzlvivbbforkeiqgrkxldrweer/Build/Products/Debug/test2 (which was built for Mac OS X 10.14)
 Expected in: /usr/lib/libnetwork.dylib

Program ended with exit code: 9
I just tried this here in my office and couldn’t reproduce the problem. Specifically, I put the following code into a new command-line tool project:

Code Block
import Network
func main() {
let listener = try! NWListener(using: .tcp, on: 12345)
print(listener)
}
main()


I then set the deployment target to 10.14. I built this project with Xcode 10.3 and it ran just fine on both 10.15.5 and 10.14.6.

The obvious difference here is that I’m using Xcode 10.3 rather than 10.1. Is there a reason you’re stuck on 10.1?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
I was not having mac os 10.14 but was trying to use development environment of 10.14 in mac os 10.13. Installed mac os 10.14 and its working fine. Thanks for the response
Error while calling NWListener in xcode 10.1
 
 
Q