When running my app with Xcode16.4, it crashed with the error:
dyld[1045]: Symbol not found: ___res_9_state
Referenced from: <8B329554-5BEF-38D0-BFCD-1731FA6120CB> /private/var/containers/Bundle/Application/00C941BA-E397-4D0B-B280-E75583FF2890/***.app/***.debug.dylib
Expected in: <7D74C679-8F55-3A01-9AA2-C205A4A19D3E> /usr/lib/libresolv.9.dylib
The ___res_9_state related code in my app is:
let state = __res_9_state()
res_9_ninit(state)
var servers = [res_9_sockaddr_union](repeating: res_9_sockaddr_union(), count: Int(MAXNS))
let found = Int(res_9_getservers(state, &servers, Int32(MAXNS)))
res_9_nclose(state)
if found > 0 {
return Array(servers[0..<found]).filter() { $0.sin.sin_len > 0 }
} else {
return []
}
Previously, __res_9_state() could run normally in Xcode 16.1
How to fix this problem?