HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了iOS 7(非越狱)Wi-Fi RSSI值大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
是否有可能在非越狱的iOS 7设备上获得Wi-Fi RSSI值?我阅读了有关MobileWiFi.framework和Apple80211功能的@L_616_2@,如果我理解正确,他们在没有越狱的情况下无法工作.

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

解决方法

我无法找到原来的帖子,但它在运行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;
}

大佬总结

以上是大佬教程为你收集整理的iOS 7(非越狱)Wi-Fi RSSI值全部内容,希望文章能够帮你解决iOS 7(非越狱)Wi-Fi RSSI值所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。