System Configuration

RSS for tag

System Configuration allows applications to access a device’s network configuration settings and determine the reachability of the device.

Posts under System Configuration tag

87 Posts

Post

Replies

Boosts

Views

Activity

CNCopySupportedInterfaces takes around 30-40s to return current connected ssid.
In our iOS application there are many places where we need to fetch current connected ssid and we are fetching it from CNCopySupportedInterfaces.We are observing an issue where CNCopySupportedInterfaces is taking 30 to 40 seconds to fetch ssid name which is therefore blocking the main thread and leading to make our application crash. We did not find any issues calling this api CNCopySupportedInterfaces on main thread specified in any of the apple documents. Please note we are experiencing this issue only in a particular network environment. Code snippet : (NSString *)getwifiName{ NSString *wifiStr = nil; CFArrayRef arrayRef = CNCopySupportedInterfaces(); NSArray *interfaces = (_bridge NSArray *)arrayRef; if (interfaces) { for (NSString *interfaceName in interfaces) { CFDictionaryRef dictRef = CNCopyCurrentNetworkInfo((CFStringRef)interfaceName); if (dictRef != NULL) { NSDictionary *networkInfo = (bridge NSDictionary *)dictRef; wifiStr = [NSString stringWithFormat:@"%@",[networkInfo objectForKey:@"SSID"]]; CFRelease(dictRef); } } CFRelease(arrayRef); } if(wifiStr == nil) { wifiStr = [NSString stringWithFormat:NSLocalizedString(@"MobileDeviceWIFINotEnable",nil)]; } NSLog(@"Connected WifiStr - %@",wifiStr); return wifiStr; }
5
0
1.4k
Sep ’21
NEHotspotConfigurationManager - iPhone internal error
Hello everyone, I tried to make my iPhone change the Wifi network using Xamarin.iOS. I have already contacted the Xamarin service who told me that the programming is translated 1:1 with Swift and that the problem is an internal iPhone error. My code is: public class ConnectToWifi : IConnectToWifi { string SSID; public string Password; public IPAddress ServerAddress; int ServerPort = -1; public bool isConnect = true; public CFSocket Socket; public CFSocket ServerSocket; NEHotspotConfigurationManager wifiManager; public ConnectToWifi() { wifiManager = new NEHotspotConfigurationManager(); } public async Task<bool> Connect(string Ip, int Port) { isConnect = false; ServerPort = Port; try { ServerAddress = new IPAddress(IPAddress.Parse(Ip).GetAddressBytes()); Socket = new CFSocket(); NEHotspotConfigurationManager.SharedManager.GetConfiguredSsids((listWifi) => { if (listWifi != null) { foreach (string ssid_selected in listWifi) { if (ssid_selected == SSID) { NEHotspotConfigurationManager.SharedManager.RemoveConfiguration(SSID); } } } }); NEHotspotConfiguration wifiNetwork = new NEHotspotConfiguration(SSID, Password, false); wifiNetwork.JoinOnce = true; wifiManager.ApplyConfiguration(wifiNetwork, (error) => { if (error != null) { System.Diagnostics.Debug.Write(error.Description); } else { System.Diagnostics.Debug.Write("Connected"); } isConnect = true; }); } catch (CFSocketException exception) { System.Diagnostics.Debug.WriteLine("Ho ricevuto questo errore nella Connect: " + exception.Message); return isConnect; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Ho ricevuto questo errore nella Connect: " + ex.Message); return isConnect; } return isConnect; } } Upon connection comes the wifiManager function.ApplyConfiguration returns the following error: ErrorDomain=NEHotspotConfigurationErrorDomain Code=8 "internal error." UserInfo={NSLocalizedDescription=internal error.} I have an iPhone X with iOS 14.6  and a MacBook with: MacOS Big Sur 14.5; Xcode Version 12.5.1; Visual Studio for Mac 8.10.7; Xamarin.iOS 14.20.0.24 (Visual Studio Community); In my AppID profile and in the Entitlements.plist file I have activated the following services: Access WiFi Information; Fonts; Hotspot; Network Extensions; Thank you very much for helping! Regards, Giacomo Ferrera
1
0
1.6k
Aug ’21
Default IPv6 route not restored
Hi! One part of my application is in charge of modifying the network configuration through the SystemConfiguration library. More specifically, I temporarily add entries under State:/Network/Service/Temp/DNS State:/Network/Service/Temp/IPv4 State:/Network/Service/Temp/IPv6 And then remove them when I'm done, expecting the network configuration to return to the one active before this procedure. I have noticed (at least in macOS Catalina) that the Default IPv6 route does not get properly restored if I do this. I can get it back by turning Off and On the network adapter, but I believe that should normally not be necessary. The steps to reproduce this are: 1) Configure a manual IPv6 address for the network adapter, for example: Router: 2001:db8:abcd:12::1 Address: 2001:db8:abcd:12::7 Prefix Length: 64 2) Check that the default IPv6 route is present through 'netsat -nr' language Internet6: Destination               Gateway             Flags     Netif Expire default                 2001:db8:abcd:12::1       UGc       en0     default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     3) Add an IPv6 entry using scutil language d.init d.add Addresses * 2001:db8:abcd:12::7 d.add InterfaceName en0 d.add PrefixLength * 64 d.add Router 2001:db8:abcd:12::1 set State:/Network/Service/Temp/IPv6 4) Default IPv6 route is still present language Internet6: Destination               Gateway             Flags     Netif Expire default                 2001:db8:abcd:12::1       UGc       en0     default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     5) Remove Temp entry language remove State:/Network/Service/Temp/IPv6  6) Default IPv6 route is gone language Internet6: Destination               Gateway             Flags     Netif Expire default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     7) Restart network adapter 8) Default IPv6 route reappears language Internet6: Destination               Gateway             Flags     Netif Expire default                 2001:db8:abcd:12::1       UGc       en0     default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     So, I wanted to know if I'm correctly assuming that the default route should not disappear after removing the IPv6 entry, and if there's any workaround I could use from within my application other than manually restarting the network adapter. Thanks!
3
0
2.6k
Aug ’21
Reachability doesn't detect LTE/5G on iOS 14/iPhone 12
I use Reachability (https://developer.apple.com/library/archive/samplecode/Reachability/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007324) for detect network status. Not always, but in some cases( 5G / iPhone12, iOS 14 ?) can't detect network status when use LTE. when turn off LTE and use Wifi then it works. the other apps are running on LTE, same device. you have any idea?
1
0
1.2k
Aug ’21
networksetup not listing app proxy config
When I'm trying to activate/incativate network service from command line, I use networksetup, and it works fine for pkt tunnel vpn config. The problem is that app proxy config is not listed, and could not be activated/inactivated from console, while it works through UI Netowrk Preferences. So when I run: networksetup listnetworkserviceorder the output doesn't match the list from Network Preferences, the app proxy configuration is not visible for this tool. It appears, that accessed from UI in Network Preferences service is not a recognized network service by networksetup. networksetup setnetworkserviceenabled TUNNEL_APP_PRXY_USR off TUNNEL_APP_PRXY_USR is not a recognized network service. ** Error: The parameters were not valid. What could go wrong and how to inactivate app proxy service from console?
0
0
668
Jul ’21
[Monterey - BETA] Monitor (ultrawide) with integrated HUB connections are not detected
Hello, I have a MPB M1 with a Phillips 439P9H/00. I recently updated from Big Sur to Monterrey due to Dropping Ethernet Connection (Dropping Ethernet Connection on Big Sur - Apple Community) And maybe the Monterrey would had fixed the problem. Unfortunately it got way worse. Before I could use all the connections via USB-C (it detected all USB's connected to monitor and RJ45 besides dropping). Now it's doesn't detect anything! It only detects the screen connection via usb-c. There is also the issue that running native Mac applications the texts seem blurry. Anyone else experiencing this?
1
0
1k
Jul ’21
CNCopySupportedInterfaces takes around 30-40s to return current connected ssid.
In our iOS application there are many places where we need to fetch current connected ssid and we are fetching it from CNCopySupportedInterfaces.We are observing an issue where CNCopySupportedInterfaces is taking 30 to 40 seconds to fetch ssid name which is therefore blocking the main thread and leading to make our application crash. We did not find any issues calling this api CNCopySupportedInterfaces on main thread specified in any of the apple documents. Please note we are experiencing this issue only in a particular network environment. Code snippet : (NSString *)getwifiName{ NSString *wifiStr = nil; CFArrayRef arrayRef = CNCopySupportedInterfaces(); NSArray *interfaces = (_bridge NSArray *)arrayRef; if (interfaces) { for (NSString *interfaceName in interfaces) { CFDictionaryRef dictRef = CNCopyCurrentNetworkInfo((CFStringRef)interfaceName); if (dictRef != NULL) { NSDictionary *networkInfo = (bridge NSDictionary *)dictRef; wifiStr = [NSString stringWithFormat:@"%@",[networkInfo objectForKey:@"SSID"]]; CFRelease(dictRef); } } CFRelease(arrayRef); } if(wifiStr == nil) { wifiStr = [NSString stringWithFormat:NSLocalizedString(@"MobileDeviceWIFINotEnable",nil)]; } NSLog(@"Connected WifiStr - %@",wifiStr); return wifiStr; }
Replies
5
Boosts
0
Views
1.4k
Activity
Sep ’21
NEHotspotConfigurationManager - iPhone internal error
Hello everyone, I tried to make my iPhone change the Wifi network using Xamarin.iOS. I have already contacted the Xamarin service who told me that the programming is translated 1:1 with Swift and that the problem is an internal iPhone error. My code is: public class ConnectToWifi : IConnectToWifi { string SSID; public string Password; public IPAddress ServerAddress; int ServerPort = -1; public bool isConnect = true; public CFSocket Socket; public CFSocket ServerSocket; NEHotspotConfigurationManager wifiManager; public ConnectToWifi() { wifiManager = new NEHotspotConfigurationManager(); } public async Task<bool> Connect(string Ip, int Port) { isConnect = false; ServerPort = Port; try { ServerAddress = new IPAddress(IPAddress.Parse(Ip).GetAddressBytes()); Socket = new CFSocket(); NEHotspotConfigurationManager.SharedManager.GetConfiguredSsids((listWifi) => { if (listWifi != null) { foreach (string ssid_selected in listWifi) { if (ssid_selected == SSID) { NEHotspotConfigurationManager.SharedManager.RemoveConfiguration(SSID); } } } }); NEHotspotConfiguration wifiNetwork = new NEHotspotConfiguration(SSID, Password, false); wifiNetwork.JoinOnce = true; wifiManager.ApplyConfiguration(wifiNetwork, (error) => { if (error != null) { System.Diagnostics.Debug.Write(error.Description); } else { System.Diagnostics.Debug.Write("Connected"); } isConnect = true; }); } catch (CFSocketException exception) { System.Diagnostics.Debug.WriteLine("Ho ricevuto questo errore nella Connect: " + exception.Message); return isConnect; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Ho ricevuto questo errore nella Connect: " + ex.Message); return isConnect; } return isConnect; } } Upon connection comes the wifiManager function.ApplyConfiguration returns the following error: ErrorDomain=NEHotspotConfigurationErrorDomain Code=8 "internal error." UserInfo={NSLocalizedDescription=internal error.} I have an iPhone X with iOS 14.6  and a MacBook with: MacOS Big Sur 14.5; Xcode Version 12.5.1; Visual Studio for Mac 8.10.7; Xamarin.iOS 14.20.0.24 (Visual Studio Community); In my AppID profile and in the Entitlements.plist file I have activated the following services: Access WiFi Information; Fonts; Hotspot; Network Extensions; Thank you very much for helping! Regards, Giacomo Ferrera
Replies
1
Boosts
0
Views
1.6k
Activity
Aug ’21
Default IPv6 route not restored
Hi! One part of my application is in charge of modifying the network configuration through the SystemConfiguration library. More specifically, I temporarily add entries under State:/Network/Service/Temp/DNS State:/Network/Service/Temp/IPv4 State:/Network/Service/Temp/IPv6 And then remove them when I'm done, expecting the network configuration to return to the one active before this procedure. I have noticed (at least in macOS Catalina) that the Default IPv6 route does not get properly restored if I do this. I can get it back by turning Off and On the network adapter, but I believe that should normally not be necessary. The steps to reproduce this are: 1) Configure a manual IPv6 address for the network adapter, for example: Router: 2001:db8:abcd:12::1 Address: 2001:db8:abcd:12::7 Prefix Length: 64 2) Check that the default IPv6 route is present through 'netsat -nr' language Internet6: Destination               Gateway             Flags     Netif Expire default                 2001:db8:abcd:12::1       UGc       en0     default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     3) Add an IPv6 entry using scutil language d.init d.add Addresses * 2001:db8:abcd:12::7 d.add InterfaceName en0 d.add PrefixLength * 64 d.add Router 2001:db8:abcd:12::1 set State:/Network/Service/Temp/IPv6 4) Default IPv6 route is still present language Internet6: Destination               Gateway             Flags     Netif Expire default                 2001:db8:abcd:12::1       UGc       en0     default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     5) Remove Temp entry language remove State:/Network/Service/Temp/IPv6  6) Default IPv6 route is gone language Internet6: Destination               Gateway             Flags     Netif Expire default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     7) Restart network adapter 8) Default IPv6 route reappears language Internet6: Destination               Gateway             Flags     Netif Expire default                 2001:db8:abcd:12::1       UGc       en0     default                 fe80::%utun0          UGcI     utun0     default                 fe80::%utun1          UGcI     utun1     So, I wanted to know if I'm correctly assuming that the default route should not disappear after removing the IPv6 entry, and if there's any workaround I could use from within my application other than manually restarting the network adapter. Thanks!
Replies
3
Boosts
0
Views
2.6k
Activity
Aug ’21
Reachability doesn't detect LTE/5G on iOS 14/iPhone 12
I use Reachability (https://developer.apple.com/library/archive/samplecode/Reachability/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007324) for detect network status. Not always, but in some cases( 5G / iPhone12, iOS 14 ?) can't detect network status when use LTE. when turn off LTE and use Wifi then it works. the other apps are running on LTE, same device. you have any idea?
Replies
1
Boosts
0
Views
1.2k
Activity
Aug ’21
networksetup not listing app proxy config
When I'm trying to activate/incativate network service from command line, I use networksetup, and it works fine for pkt tunnel vpn config. The problem is that app proxy config is not listed, and could not be activated/inactivated from console, while it works through UI Netowrk Preferences. So when I run: networksetup listnetworkserviceorder the output doesn't match the list from Network Preferences, the app proxy configuration is not visible for this tool. It appears, that accessed from UI in Network Preferences service is not a recognized network service by networksetup. networksetup setnetworkserviceenabled TUNNEL_APP_PRXY_USR off TUNNEL_APP_PRXY_USR is not a recognized network service. ** Error: The parameters were not valid. What could go wrong and how to inactivate app proxy service from console?
Replies
0
Boosts
0
Views
668
Activity
Jul ’21
[Monterey - BETA] Monitor (ultrawide) with integrated HUB connections are not detected
Hello, I have a MPB M1 with a Phillips 439P9H/00. I recently updated from Big Sur to Monterrey due to Dropping Ethernet Connection (Dropping Ethernet Connection on Big Sur - Apple Community) And maybe the Monterrey would had fixed the problem. Unfortunately it got way worse. Before I could use all the connections via USB-C (it detected all USB's connected to monitor and RJ45 besides dropping). Now it's doesn't detect anything! It only detects the screen connection via usb-c. There is also the issue that running native Mac applications the texts seem blurry. Anyone else experiencing this?
Replies
1
Boosts
0
Views
1k
Activity
Jul ’21
Apache server no longer works on Monterey Public Beta
I updated my Mac to macOS Monterey, and all of a sudden, I can't access localhost, on any browser. Safari says it can't find the server, and Chrome says that the server refused to connect. There seem to be no errors when I run apachectl configtest. How do I fix this?
Replies
0
Boosts
0
Views
565
Activity
Jul ’21