how to enumerate all available Wifi networks at range?

空扰寡人 提交于 2019-11-30 07:42:35

问题


I read on google that this is not possible, and that on OS 2.0, it was some undocumented Api to accomplish that, but then your app will got rejected ....

we are almosto on OS 4.0....any news regarding this?


回答1:


There are pre-2.0 solutions to be found on the Internet. One of them seems to be as follows:

void *libHandle;
void *airportHandle;
int (*open)(void *);
int (*bind)(void *, NSString *);
int (*close)(void *);

libHandle = dlopen("/System/Library/Frameworks/Preferences.framework/Preferences", RTLD_LAZY);
open = dlsym(libHandle, "Apple80211Open");
bind = dlsym(libHandle, "Apple80211BindToInterface");
close = dlsym(libHandle, "Apple80211Close");

open(&airportHandle);
bind(airportHandle, CFSTR("en0"));
close(&airportHandle);

dlclose(libHandle);

I'm not sure if accessing this framework is off limits. But running it causes a EXC_BAD_ACCESS. So either the code is wrong, the framework has changed or it's somehow locked. Forgive me for any obvious Objective-C faux-pas. I've only been speaking Objective-C since Thursday, so my Objective-C fluency is probably like parachuting a latin speaker into a hostile Transylvanian mountian region.



来源:https://stackoverflow.com/questions/3019336/how-to-enumerate-all-available-wifi-networks-at-range

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!