在ios7.1.2下
尝试使用CoreTelephony.framework的 CTIndicator来获取蜂窝网信号的强度数值
long int raw = 0;
long int graded = 0;
long int bars = 0;
CTIndicatorsGetSignalStrength(&raw, &graded, &bars);
获取到的是4294967192,明显不对。。。。。
尝试使用MobileWiFi.framewor来获取wifi信号的强度数值(http://iphonedevwiki.net/index.php/MobileWiFi.framework)
WiFiManagerRef manager = WiFiManagerClientCreate(kCFAllocatorDefault, 0);
CFArrayRef devices = WiFiManagerClientCopyDevices(manager);
WiFiDeviceClientRef client = (WiFiDeviceClientRef)CFArrayGetValueAtIndex(devices, 0);
CFDictionaryRef data = (CFDictionaryRef)WiFiDeviceClientCopyProperty(client, CFSTR("RSSI"));
CFNumberRef scaled = (CFNumberRef)WiFiDeviceClientCopyProperty(client, 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);
通过打印发现执行到
WiFiDeviceClientRef client = (WiFiDeviceClientRef)CFArrayGetValueAtIndex(devices, 0);
这里就没往下执行了
尝试使用liblockdown.dylib来获取imei号(http://iphonedevwiki.net/index.php/Liblockdown.dylib)
LockdownConnectionRef connection = lockdown_connect();
NSString *imei = (NSString *)lockdown_copy_value(connection, NULL, kLockdownIMEIKey);
lockdown_disconnect(connection);
返回的是null
使用ikoit的category获取imei
NSArray *results = getValue(@"device-imei");
返回仍然是空的。。。。。。
我就想请教各位大神,到底是我写的问题还是在7.1.2下,这些都不能用了,如果是我的问题可否帮忙指点下,如果是不能用了,能否指一条明路该从哪里下手。。。。。