IP配置apple80211Open()在iOS8上崩溃

我正在尝试将AP WIFI连接的RSSI读取到AP。

使用Xcode 6.1.1和iPhone6 + ios 8.1.3

下面的代码在apple80211Open()崩溃并在iOS 8上获得E XC_BAD_ACCESS (code=1, address= 0) 。(代码适用于iOS 7.1)

这适用于不适用于Apple Store的应用 – 仅适用于adhoc发行。

================================================== ===============

 void *libHandle; void *airportHandle; int (*apple80211Open)(void *); int (*apple80211Bind)(void *, NSString *); int (*apple80211Close)(void *); int (*apple80211GetInfoCopy)(void *, CFDictionaryRef *); NSMutableDictionary *infoDict = [NSMutableDictionary new]; NSDictionary * tempDictionary; libHandle = dlopen("/System/Library/SystemConfiguration/IPConfiguration.bundle/IPConfiguration", RTLD_LAZY); char *dlerror_error; if (libHandle == NULL && (dlerror_error = dlerror()) != NULL) { NSLog(@"%s", dlerror_error); } apple80211Open = dlsym(libHandle, "Apple80211Open"); apple80211Bind = dlsym(libHandle, "Apple80211BindToInterface"); apple80211Close = dlsym(libHandle, "Apple80211Close"); apple80211GetInfoCopy = dlsym(libHandle, "Apple80211GetInfoCopy"); apple80211Open(&airportHandle); apple80211Bind(airportHandle, @"en0"); CFDictionaryRef info = NULL; apple80211GetInfoCopy(airportHandle, &info); tempDictionary = (__bridge NSDictionary *)info; apple80211Close(airportHandle); [infoDict setObject:(tempDictionary[@"RSSI"])[@"RSSI_CTL_AGR"] ? (tempDictionary[@"RSSI"])[@"RSSI_CTL_AGR"] : @"0" forKey:@"RSSI"]; [infoDict setObject:tempDictionary[@"BSSID"] ? tempDictionary[@"BSSID"] : @"null" forKey:@"BSSID"]; [infoDict setObject:tempDictionary[@"SSID_STR"] ? tempDictionary[@"SSID_STR"] : @"null" forKey:@"SSID"]; [infoDict setObject:tempDictionary[@"RATE"] ? tempDictionary[@"RATE"] : @"0" forKey:@"SPEED"]; 

这是因为Apple从IPConfiguration中删除了80211框架。 无法找到符号,dlsym返回NULL,并且 – 崩溃(您应该始终检查返回值,您知道)。

首先,这是一个私人框架。 在新版本的iOS(8+)中,它不赞成使用MobileWifi,并且使用权利(和XPC)以便将/ usr / libexec / wifid用于所有工作。

在这篇文章中有更多细节: http : //newosxbook.com/articles/11208ellpA.html