Post

Replies

Boosts

Views

Activity

Is there any plan in the future to open up an API for accessing the current Wi-Fi frequency band information on iOS?
More and more routers are establishing Wi-Fi networks with a mixed frequency band of 2.4G and 5G, but most smart accessory (IoT devices) only support 2.4G Wi-Fi. Our business requires us to determine the current Wi-Fi frequency band information that iOS is connected to, and if it is 5G, provide a reminder to the user.
2
0
362
May ’23
Some iPhones are unable to obtain IP addresses.
When I use the following code to try to obtain an IP address, some phones fail to get the IP address. + (NSDictionary *)getWLANAddressInfo { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; struct ifaddrs *interfaces = NULL; struct ifaddrs *temp_addr = NULL; int success = 0; // retrieve the current interfaces - returns 0 on success success = getifaddrs(&interfaces); if (success == 0) { // Loop through linked list of interfaces temp_addr = interfaces; while(temp_addr != NULL) { if(temp_addr->ifa_addr->sa_family == AF_INET) { // Check if interface is en0 which is the wifi connection on the iPhone if([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en0"]) { // Get NSString from C String NSString *address = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)]; NSString *dstaddr = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_dstaddr)->sin_addr)]; [dict setObject:address forKey:@"ip"]; [dict setObject:dstaddr forKey:@"dst"]; } } temp_addr = temp_addr->ifa_next; } } // Free memory freeifaddrs(interfaces); return dict; } The affected phones have iOS versions 16.3.1 and 16.4, Has anyone else encountered the same issue? What's causing this issue and how can I work around it?
9
0
2.3k
Mar ’23