adodo1
V2EX  ›  iOS

求助: iOS8 如何扫描 WiFi 列表

  •  
  •   adodo1 · Jul 5, 2015 · 5575 views
    This topic created in 3994 days ago, the information mentioned may be changed or developed.

    想这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 replies    2015-07-05 13:44:10 +08:00
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5416 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 07:53 · PVG 15:53 · LAX 00:53 · JFK 03:53
    ♥ Do have faith in what you're doing.