【问题标题】:iOS Framework not found未找到 iOS 框架
【发布时间】:2014-02-21 21:49:39
【问题描述】:

我需要在 Objective C 中运行一个程序。我找到了获取 wifi 信号强度的代码。

我没有得到 mobilewifi.h 文件?这将在哪里可用。我用谷歌搜索了它。

此外,我不知道我应该将此文件保存在项目中的哪个位置?在哪个 .m 文件中?应用代理??

代码是:

#include <math.h>
#include <MobileWiFi.h>

WiFiManagerRef manager = WiFiManagerClientCreate(kCFAllocatorDefault, 0);
CFArrayRef devices = WiFiManagerClientCopyDevices(_manager);

WiFiDeviceClientRef client = (WiFiDeviceClientRef)CFArrayGetValueAtIndex(devices, 0);
CFDictionaryRef data = (CFDictionaryRef)WiFiDeviceClientCopyProperty(_device, CFSTR("RSSI"));
CFNumberRef scaled = (CFNumberRef)WiFiDeviceClientCopyProperty(_device, kWiFiScaledRSSIKey);

CFNumberRef RSSI = (CFNumberRef)CFDictionaryGetValue(data, CFSTR("RSSI_CTL_AGR"));

int raw;
CFNumberGetValue(RSSI, kCFNumberIntType, &raw);

float strength;
CFNumberGetValue(scaled, kCFNumberFloatType, &strength);
CFRelease(scaled);

strength *= -1;

// Apple uses -3.0.
int bars = (int)ceilf(strength * -3.0f);
bars = MAX(1, MIN(bars, 3));


printf("WiFi signal strength: %d dBm\n\t Bars: %d\n", raw,  bars);

CFRelease(data);
CFRelease(scaled);
CFRelease(devices);
CFRelease(manager);

【问题讨论】:

  • 那是一个私有框架。除非你想(可能)被苹果拒绝,否则你不应该使用它。
  • @Putz1103 我只想要它用于我的研究工作
  • 你解决了吗?我有同样的问题,我无法使用框架。如果你这样做了,你可以在这里看到我的问题:stackoverflow.com/questions/31557922/…

标签: ios iphone objective-c xcode


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-31
  • 1970-01-01
  • 2018-10-30
  • 2016-10-03
  • 2014-12-07
  • 2011-09-21
相关资源
最近更新 更多