想这iPhone上扫描附近WiFi的SSID和MAC地址
软件不需要上架(App Stroe)
网上找了好多,都是利用私有框架 MobileApple80211 来实现的
但是这个私有方法好像中iOS8里被移除了
代码执行到这一句的时候
apple80211Open(&airportHandle);
就会抛出异常
EXC_BAD_ACCESS (code=1, address= 0)
stackoverflow里找到相关的提问,但是都没有很好的解答
http://stackoverflow.com/questions/29044036/ipconfiguration-apple80211open-crashes-on-ios8
关键几行代码如下
libHandle = dlopen("/System/Library/SystemConfiguration/IPConfiguration.bundle/IPConfiguration", RTLD_LAZY);
//--------
apple80211Open = dlsym(libHandle, "Apple80211Open");
apple80211Bind = dlsym(libHandle, "Apple80211BindToInterface");
apple80211Close = dlsym(libHandle, "Apple80211Close");
apple80211GetInfoCopy = dlsym(libHandle, "Apple80211GetInfoCopy");
apple80211Open(&airportHandle);
apple80211Bind(airportHandle, @"en0");
1
sobigfish 2015-07-05 13:44:10 +08:00
|