列出/扫描可用的WiFis iPhone [英] List / Scan for available WiFis iPhone
问题描述
我正在寻找一种在iPhone App中展示可用WiFis的方法。
到目前为止,我的研究结果如下:
I'm searching for a way to present available WiFis in an iPhone App. So far my research resulted in the following:
- 实施(编辑)此类功能的应用程序已从AppStore中删除(意味着您无法通过AppStore部署应用程序,这对我来说很好。)
- Apple隐藏了私有框架中扫描所需的功能,但您找不到任何解释/关于如何使用的评论/示例
- http:/ /code.google.com/p/iphone-wireless 似乎最有希望。无论如何,我无法弄清楚如何在我的代码中包含交付的源,以便它在设备上运行
- Apps that implement(ed) such a functionality were removed from the AppStore (means you can't deploy the App via AppStore which is fine for me)
- Apple hides the functionality that is necessary for a scan in a private framework and you can't find any explanations/comments/examples on "how to use"
- http://code.google.com/p/iphone-wireless seems to be most promising. anyway, i can't figure out how to include the delivered sources in my code so that it runs on a device
即使是适配提到的htt://code.google.com/p/iphone-wireless/issues/detail?id = 26没有得到我想要的结果。最大的进展是以
Even the adaptions that are mentioned htt ://code.google.com/p/iphone-wireless/issues/detail?id=26 didn't get me the desired results. The most progress was ending up with a
dlopen错误:dlopen(/System/Library/SystemConfiguration/Aeropuerto.bundle/Aeropuerto,1) :图像未找到
失败:__ Apple80211Associate
dlopen error: dlopen(/System/Library/SystemConfiguration/Aeropuerto.bundle/Aeropuerto, 1): image not found failed: __Apple80211Associate
在设备上启动应用程序后的消息(iPhone 3GS; iOS 3.1.3 )。
message after launching the app on a device (iPhone 3GS; iOS 3.1.3).
使用了产生错误的源代码:
Used source code that procudes the error is here:
NSMutableDictionary *networks;
bool scanning;
void *libHandle;
void *airportHandle;
int (*open)(void *);
int (*bind)(void *, NSString *);
int (*close)(void *);
int (*scan)(void *, NSArray **, void *);
networks = [[NSMutableDictionary alloc] init];
// libHandle = dlopen("/System/Library/Frameworks/Preferences.framework/Preferences", RTLD_LAZY);
// libHandle = dlopen("/System/Library/PrivateFrameworks/Apple80211.framework/Preferences", RTLD_LAZY);
libHandle = dlopen("/System/Library/SystemConfiguration/WiFiManager.bundle/WiFiManager", RTLD_LAZY);
open = dlsym(libHandle, "Apple80211Open");
bind = dlsym(libHandle, "Apple80211BindToInterface");
close = dlsym(libHandle, "Apple80211Close");
scan = dlsym(libHandle, "Apple80211Scan");
open(&airportHandle);
bind(airportHandle, @"en0");
NSLog(@"Scanning...");
scanning = true;
NSArray *scan_networks;
NSDictionary *parameters = [[NSDictionary alloc] init];
scan(airportHandle, &scan_networks, parameters);
bool changed;
for (int i = 0; i < [scan_networks count]; i++) {
if([networks objectForKey:[[scan_networks objectAtIndex: i] objectForKey:@"BSSID"]] != nil
&& ![[networks objectForKey:[[scan_networks objectAtIndex: i] objectForKey:@"BSSID"]] isEqualToDictionary:[scan_networks objectAtIndex: i]])
changed = true;
[networks setObject:[scan_networks objectAtIndex: i] forKey:[[scan_networks objectAtIndex: i] objectForKey:@"BSSID"]];
}
if(changed) {
NSLog(@"NetworksUpdated");
}
scanning = false;
NSLog(@"Scan Finished...");
NSLog(@"Found %i networks: %@", [networks count], networks);
即使尝试其中一条注释行,它也不起作用:
program收到EXC_BAD_ACCESS和几个
Even if trying one of the other commented lines, it doesn't work: program received EXC_BAD_ACCESS and several
警告:check_safe_call:无法恢复当前帧
warning: check_safe_call: could not restore current frame
警告:无法恢复以前选择的框架。
warning: Unable to restore previously selected frame.
我正在搜索的是如何在我的项目中包含iphone-wireless以及如何修改给定的代码?
另一种方法是提示如何在您的环境中扫描WiFis。
What i'm searching are hints how to include iphone-wireless in my project and how to modify the given code? An alternative would be a tip on how to scan for WiFis in your environment.
如果有人可以提供帮助,那会很好。
Would be nice if someone could help.
推荐答案
有关iphone无线的使用示例,您可以查看以下帖子,
For a usage sample of iphone wireless, you can check following post,
http://blog.guvenergokce.com/iphone-wireless-scanner-ios5/
在那里你还可以找到一个用XCode 4.2开发的示例项目。
There you'll also find a sample project developed with XCode 4.2.
正如你所提到的,这只适用于研究或私人项目,我们不能分发。
As you have mentioned, this is only for research or private projects, we can not distribute.
祝你好运,
Guvener
这篇关于列出/扫描可用的WiFis iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!