Post

Replies

Boosts

Views

Activity

iOS13 NEHotspotConfiguration internal error
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; }
6
0
2.4k
Jan ’20