#Xcode16 compatible HttpDNS 2.2.0 is compiled by Xcode16, don't support Xcode16 If you're using Xcode15, please use 2.1.0
Apple request developer to update to Xcode16 news link: https://developer.apple.com/news/?id=9s0rgdy9
Beginning April 24, 2025, apps uploaded to App Store Connect must be built with Xcode 16 or later using an SDK for iOS 18, iPadOS 18, tvOS 18, visionOS 2, or watchOS 11.
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/DLinkSDK/deeplink-dev-specs.git'pod 'HttpDNS'let dnsFetcher: HttpDNSFetcher = .init(identifier: "mainDNSFetcher", queue: .init(identifier: "mainDNSFetcher", queue: .global()))If you want to http dns work on your prefer queue, pass the queue to the initialze method
let domains: [String] = [
"google.com",
"youtube.com"
]
// preload some domains
dnsFetcher.preload(domains: domains)If dns info for domain has been resolved, you can get the cached dns info.
let domain = "google.com"
if let cachedDNS = dnsFetcher.getCachedDNSInfo(for: domain) {
print("cached dns for \(domain) is \(cachedDNS)")
} else {
print("dns not resolved yet")
}dnsFetcher.refresh(domain: "google.com", force: true)let request = dnsInfo.createURLRequest(scheme: "https", path: "index.html")or you can construct an url by direct using ip info in dns resolved.
let urlString = "https://" + dnsInfo.ipv4 + "/index.html"You can also use combine to observe dns info change. Update your business info when the callback fires.
dnsFetcher.publisherForDNSInfos()
.sink(receiveValue: { dnsInfo in
print("dns info updated \(dnsInfo)")
})