@eskimo
Whoops 🤦🏼
I've added it now. Apparently something is wrong with my dispatch queue too, as even when properly starting the path monitor, I never got the updates. But it works fine using the main queue… Not entirely sure why yet. But anyway everything seems to work fine now even when enabling the Sandbox, I still get the warnings in the console but it works regardless. Thanks a lot for your help!
_nwqueue = _nwqueue = dispatch_get_main_queue();
__block nw_interface_t intf = NULL;
if (@available(macOS 13.0, *)) {
_monitor = nw_path_monitor_create_for_ethernet_channel();
nw_path_monitor_set_queue(_monitor, _nwqueue);
nw_path_monitor_set_update_handler(_monitor, ^(nw_path_t _Nonnull path) {
nw_path_enumerate_interfaces(path, ^bool(nw_interface_t _Nonnull interface) {
const char *name = nw_interface_get_name(interface);
uint32_t index = nw_interface_get_index(interface);
NSLog(@"Interface %u: %s", index, name);
return true;
});
});
nw_path_monitor_start(_monitor);
} else {
// ...
}
Topic:
App & System Services
SubTopic:
Networking
Tags: