Xcode-6.4 (6E23): Calling `CFHostStartInfoResolution` from `Swift` is impossible due to the method’s signature.
| Originator: | me | ||
| Number: | rdar://21275861 | Date Originated: | 06-Jun-2015 10:43 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-6.4 (6E23) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
Calling `CFHostStartInfoResolution` from `Swift` is impossible due to the method’s signature.
Steps to Reproduce:
Open a new `Playground` and paste the following code:
```
let hostaddr = "google.com"
let host:CFHost! = CFHostCreateWithName(kCFAllocatorDefault, hostaddr).takeRetainedValue()
let error = UnsafeMutablePointer<CFStreamError>.alloc(1)
if CFHostStartInfoResolution(host, CFHostInfoType.Addresses, error) {
let hbr = UnsafeMutablePointer<Boolean>()
addresses = CFHostGetAddressing(host, hbr)
}
host.release()
error.dealloc(1)
```
Expected Results:
The code should compile and run.
Actual Results:
The compiler complains because the provided params doesn’t match the method’s signature even though they are the same.
Regression:
From the following links you can check that this was possible on previous versions of Swift:
http://stackoverflow.com/questions/24898001/do-a-simple-dns-lookup-in-swift
http://stackoverflow.com/questions/24794997/convert-nsdata-to-sockaddr-struct-in-swift
Notes: See attached screenshots
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!