Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
594 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...