Posts

Post not yet marked as solved
6 Replies
2.1k Views
NEHotspotConfigurationManager working normally in iOS 12, IOS 13 (13.0~13.3), in general, it works well, but sometimes internal error will appear,In this case, I only restart the device to solve the problem.NSString *ssid = @"***"; NSString *password = @"***"; if (@available(iOS 11.0, *)) { NEHotspotConfiguration * config = [[NEHotspotConfiguration alloc] initWithSSID:ssid passphrase:password isWEP:NO]; [[NEHotspotConfigurationManager sharedManager] getConfiguredSSIDsWithCompletionHandler:^(NSArray * _Nonnull list) { // if( ![list containsObject:ssid] ){ [[NEHotspotConfigurationManager sharedManager] applyConfiguration:config completionHandler:^(NSError * _Nullable error) { NSLog(@"%@",error); }]; // } }]; } else { // Fallback on earlier versionsThe same thing happened when I try get my WiFi SSID, anyway, I only get null.After restarting the device, I can read the correct SSID- (NSString*)fetchSSID { NSString *wifiName = [NSString stringWithFormat:@""]; CFArrayRef wifiInterfaces = CNCopySupportedInterfaces(); if (!wifiInterfaces) { return wifiName; } NSArray *interfaces = (__bridge NSArray *)wifiInterfaces; for (NSString *interfaceName in interfaces) { CFDictionaryRef dictRef = CNCopyCurrentNetworkInfo((__bridge CFStringRef)(interfaceName)); if (dictRef) { NSDictionary *networkInfo = (__bridge NSDictionary *)dictRef; wifiName = [NSString stringWithFormat:@"%@",[networkInfo objectForKey:(__bridge NSString *)kCNNetworkInfoKeySSID]]; CFRelease(dictRef); } } CFRelease(wifiInterfaces); return wifiName; }
Posted
by hanabi.
Last updated
.
Post not yet marked as solved
4 Replies
2.1k Views
I can't get SSID in iOS 13, it is available in iOS12, I already add 'Access WiFi Information'. NSString *wifiName = [NSString stringWithFormat:@""]; CFArrayRef wifiInterfaces = CNCopySupportedInterfaces(); NSArray *interfaces = (__bridge NSArray *)wifiInterfaces; for (NSString *interfaceName in interfaces) { CFDictionaryRef dictRef = CNCopyCurrentNetworkInfo((__bridge CFStringRef)(interfaceName)); if (dictRef) { NSDictionary *networkInfo = (__bridge NSDictionary *)dictRef; wifiName = [NSString stringWithFormat:@"%@",[networkInfo objectForKey:(__bridge NSString *)kCNNetworkInfoKeySSID]]; CFRelease(dictRef); } } CFRelease(wifiInterfaces);
Posted
by hanabi.
Last updated
.