【问题标题】:iOS 7 (non-jailbreak) Wi-Fi RSSI valueiOS 7(非越狱)Wi-Fi RSSI 值
【发布时间】:2014-10-05 05:04:36
【问题描述】:

是否可以在未越狱的 iOS 7 设备上获取 Wi-Fi RSSI 值?我阅读了有关 MobileWiFi.framework 和 Apple80211 函数的信息,如果我理解正确,它们在没有越狱的情况下无法工作。

我不想在 AppStore 上发布我的应用程序,因此允许使用 PrivateAPI。

【问题讨论】:

标签: ios ios7 iphone-privateapi rssi


【解决方案1】:

我找不到原始帖子的拍摄地点,但它在运行 iOS 7.1 的入狱设备上对我有用(不适用于 iOS 8):

#include <dlfcn.h>

-(NSDictionary *)currentWiFiInfo
{
   void *libHandle;
   void *airportHandle;

   int (*apple80211Open)(void *);
   int (*apple80211Bind)(void *, NSString *);
   int (*apple80211Close)(void *);
   int (*apple80211GetInfoCopy)(void *, CFDictionaryRef *);

   NSMutableDictionary *infoDict = [NSMutableDictionary new];
   NSDictionary * tempDictionary;
   libHandle = dlopen("/System/Library/SystemConfiguration/IPConfiguration.bundle/IPConfiguration", RTLD_LAZY);

   char *error;

   if (libHandle == NULL && (error = dlerror()) != NULL)  {
      NSLog(@"%s", error);
   }

   apple80211Open = dlsym(libHandle, "Apple80211Open");
   apple80211Bind = dlsym(libHandle, "Apple80211BindToInterface");
   apple80211Close = dlsym(libHandle, "Apple80211Close");
   apple80211GetInfoCopy = dlsym(libHandle, "Apple80211GetInfoCopy");

   apple80211Open(&airportHandle);
   apple80211Bind(airportHandle, @"en0");

   CFDictionaryRef info = NULL;

   apple80211GetInfoCopy(airportHandle, &info);

   tempDictionary = (__bridge NSDictionary *)info;

   apple80211Close(airportHandle);

   [infoDict setObject:(tempDictionary[@"RSSI"])[@"RSSI_CTL_AGR"] ? (tempDictionary[@"RSSI"])[@"RSSI_CTL_AGR"] : @"0" forKey:@"RSSI"];
   [infoDict setObject:tempDictionary[@"BSSID"] ? tempDictionary[@"BSSID"] : @"null" forKey:@"BSSID"];
   [infoDict setObject:tempDictionary[@"SSID_STR"] ? tempDictionary[@"SSID_STR"] : @"null" forKey:@"SSID"];
   [infoDict setObject:tempDictionary[@"RATE"] ? tempDictionary[@"RATE"] : @"0" forKey:@"SPEED"];

   return infoDict;
}

【讨论】:

  • @doxsi 这对我在被监禁(未越狱)的设备上有用
  • 您能分享一下您遵循的步骤吗?
猜你喜欢
  • 1970-01-01
  • 2023-04-04
  • 2013-02-02
  • 1970-01-01
  • 1970-01-01
  • 2014-01-13
  • 1970-01-01
  • 2014-08-22
  • 2013-10-04
相关资源
最近更新 更多