iOS 获取蜂窝信号强度

调用CoreTelephony.framework的私有函数“CTGetSignalStrength”能够获取信号,如下:

int getSignalStrength()
{
void *libHandle = dlopen("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTLD_LAZY);
int (*CTGetSignalStrength)();
CTGetSignalStrength = dlsym(libHandle, "CTGetSignalStrength");
if( CTGetSignalStrength == NULL) NSLog(@"Could not find CTGetSignalStrength"); 
int result = CTGetSignalStrength();
dlclose(libHandle);
return result;
}

你可能感兴趣的:(ios,蜂窝-信号强度)