gpt4 book ai didi

iphone - 检测无线网络名称

转载 作者:可可西里 更新时间:2023-11-01 05:02:55 26 4
gpt4 key购买 nike

是否可以运行一个方法来返回用户所连接的无线网络的名称?在我的应用程序内部,我希望能够返回用户连接到的无线网络的名称。

最佳答案

这对我来说非常有效:

#import <SystemConfiguration/CaptiveNetwork.h>

CFArrayRef myArray = CNCopySupportedInterfaces();
CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
// NSLog(@"SSID: %@",CFDictionaryGetValue(myDict, kCNNetworkInfoKeySSID));
NSString *networkName = CFDictionaryGetValue(myDict, kCNNetworkInfoKeySSID);

if ([networkName isEqualToString:@"Hot Dog"])
{
self.storeNameController = [[StoreDataController alloc] init];
[self.storeNameController addStoreNamesObject];
}
else {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle: @"Connection Failed"
message: @"Please connect to the Hot Dog network and try again"
delegate: self
cancelButtonTitle: @"Close"
otherButtonTitles: nil];

[alert show];

关于iphone - 检测无线网络名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13195717/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com