We do not understand why , in the following code sequence , all the get functions return the right value , and not the first one SCNetworkInterfaceGetConfiguration which returns nothing ?
<
let arr: CFArray = SCNetworkInterfaceCopyAll()
let interfaces: [SCNetworkInterface] = arr as! [SCNetworkInterface]
for interface in interfaces {
let intDic: CFDictionary? = SCNetworkInterfaceGetConfiguration(interface)
if intDic != nil {
print (intDic)
}
if let bsd: String = SCNetworkInterfaceGetBSDName(interface) as String? {
print (bsd)
}
if let adress: String = SCNetworkInterfaceGetHardwareAddressString(interface) as String? {
print (adress)
}
if let type: String = SCNetworkInterfaceGetInterfaceType(interface) as String? {
print (type)
}
if let local: String = SCNetworkInterfaceGetLocalizedDisplayName(interface) as String? {
print (local)
}
let typeId: CFTypeID = SCNetworkInterfaceGetTypeID()
if let intSup: CFArray = SCNetworkInterfaceGetSupportedInterfaceTypes(interface) as CFArray? {
print (intSup)
}
if let prot: [String] = SCNetworkInterfaceGetSupportedProtocolTypes(interface) as? [String] {
print (prot)
}
}
>
macos 10.15.4 xcode 11.4.1