我的代码我正在尝试使用 SCNetworkSetGetServiceOrder 来获取网络服务订单。像下面
Ethernet
FireWire
Wi-Fi
Bluetooth PAN
Thunderbolt Bridge
我正在使用下面的代码
-(void)getserviceorder
{
CFArrayRef interfaces;
CFIndex interfaceCount;
CFIndex interfaceIndex;
CFMutableArrayRef result;
CFArrayRef *portArray;
portArray = NULL;
result = NULL;
interfaces = NULL;
if (SCNetworkInterfaceCopyAll != NULL) {
interfaces = SCNetworkInterfaceCopyAll();
interfaceCount = CFArrayGetCount(interfaces);
for (interfaceIndex = 0; interfaceIndex < interfaceCount;
interfaceIndex++) {
SCNetworkInterfaceRef thisInterface;
SCNetworkSetRef set = CFArrayGetValueAtIndex(interfaces,interfaceIndex);
assert(thisInterface != NULL);
NSLog(@"SCNetworkSetGetServiceOrder is %@",SCNetworkSetGetServiceOrder(set));
}
CFRelease(interfaces);
}
但它总是返回 null。这是正确的方法还是我如何使用 SCNetworkSetGetServiceOrder 方法来获取服务订单。的值应该是多少(SCNetworkSetRef set)
,是SCNetworkSetGetServiceOrder
method的参数。我在哪里可以了解更多信息