iPhone Wifi扫描机 [英] iPhone Wifi Scan Stumbler

查看:62
本文介绍了iPhone Wifi扫描机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从此处使用SOLStumbler:访问&使用MobileWiFi.framework 扫描wifi网络.我知道苹果不支持此功能,但这是出于教育目的和实验目的.我将以下文件添加到我的应用程序中,并且可以正常编译,但始终会退出并显示错误代码.(作为".m"文件的一部分.)有人知道如何使它正常工作吗?

I am trying to use the SOLStumbler from here: Accessing & Using the MobileWiFi.framework to scan for wifi networks. I am aware that this is not supported by apple but it is for educational purposes and experiments. I add the following files to my application and it compiles fine but it always exits with an error code. (As part of the ".m" file.) Does anyone know how to get this working?

SOLStumbler.h :

SOLStumbler.m :

SOLStumbler.m的此部分始终输出单个字母错误.通常为 e ,但有时为 u .

This part of SOLStumbler.m always outputs a single letter error. Normally e but sometimes u.

libHandle = dlopen("/System/Library/SystemConfiguration/WiFiManager.bundle/WiFiManager", RTLD_LAZY);

    char *error;
    if (libHandle == NULL && (error = dlerror()) != NULL)  {
            NSLog(@"%c",error);
            exit(1);
    }

我的ViewController代码:

My ViewController code:

#import "SOLStumbler.h"

-(void)viewDidLoad{
    SOLStumbler *networksManager = [[SOLStumbler alloc] init];      
    [networksManager scanNetworks]; 
    NSLog(@"%@", [networksManager description]);
    [networksManager release];  
}

推荐答案

您要使用的 SOLStumbler 代码已经很老了.这些内容(例如 WiFiManager )位于私有框架中.这意味着Apple可以并且经常会更改它,或者在不同的操作系统版本之间进行迁移.

The SOLStumbler code you're trying to use is pretty old. This stuff (e.g. WiFiManager) is in a private framework. That means Apple can, and often will, change it or move if from OS version to version.

我认为您现在正在使用iOS 5?

I assume you're now using iOS 5?

我已经登录到iOS 5手机,

I logged in to my iOS 5 phone, and indeed,

/System/Library/SystemConfiguration/WiFiManager.bundle/

不存在.因此,这就是您的代码失败的原因.

does not exist. So that's why your code fails.

看看这个有用的线程.

您现在似乎可以在 IPConfiguration 框架中找到等效的(?)函数.尝试以下代码:

It looks like you can now find equivalent (?) functions in the IPConfiguration framework. Try this code:

libHandle = dlopen("/System/Library/SystemConfiguration/IPConfiguration.bundle/IPConfiguration", RTLD_LAZY);

我在越狱的iOS 5.0.1手机上运行了它,并正常工作(加载了dylib,并找到了一些Apple80211功能).从我链接到的线程来看,您可能需要在越狱电话的/Applications 中安装此程序,才能正常工作.或者,可能不得不在您的沙盒应用中添加一些权利.

I ran it on a jailbroken iOS 5.0.1 phone and it worked (loaded the dylib and found a few of the Apple80211 functions). From that thread I linked to, it looks like you may need to have this installed in /Applications on a jailbroken phone, in order to work fully. Or, possibly have to mess around with adding some entitlements to your sandboxed app.

这篇关于iPhone Wifi扫描机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆