Thanks @eskimo,
I just tried the new API, however I never get it to print any interfaces, maybe I am doing some obvious mistake here that I am missing?
dispatch_queue_attr_t attributes = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INITIATED, -1);
attributes = dispatch_queue_attr_make_initially_inactive(attributes);
_nwqueue = dispatch_queue_create("de.epirat.nwqueue", attributes);
if (@available(macOS 13.0, *)) {
nw_path_monitor_t 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;
});
});
} else {
// ...
}
In addition, when Sandbox is enabled, I get a bunch of log messages warning about not being able to access preferences:
2022-07-22 17:02:34.351448+0200 LEDSender[28683:2062406] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x60000338c100> (Domain: com.apple.powerlogd, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access
2022-07-22 17:02:34.466892+0200 LEDSender[28683:2062406] [] networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception.
2022-07-22 17:02:34.467026+0200 LEDSender[28683:2062406] [] networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception.
(I already updated my Feedback with these information as well)