使用CTGetSignalStrength()计算IOS信号强度

使用CTGetSignalStrength()计算IOS信号强度,ios,objective-c,xcode,swift,ios8,Ios,Objective C,Xcode,Swift,Ios8,我已经开始为iOS 8.3开发一个非Apple store应用程序,它测量并返回以dB为单位的接收信号强度指示器(RSSI)值。我访问了一个名为VAFieldTest的Xcode项目的git存储库,该项目使用核心电话框架来访问诸如cell ID、服务mnc、RSSI等信息。但是,该项目的构建失败并返回以下错误: Ld /Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouiv

我已经开始为iOS 8.3开发一个非Apple store应用程序,它测量并返回以dB为单位的接收信号强度指示器(RSSI)值。我访问了一个名为VAFieldTest的Xcode项目的git存储库,该项目使用核心电话框架来访问诸如cell ID、服务mnc、RSSI等信息。但是,该项目的构建失败并返回以下错误:

    Ld /Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Products/Debug-iphonesimulator/VAFieldTest.app/VAFieldTest normal i386
    cd /Users/rajesh/Documents/VAFieldTest
    export IPHONEOS_DEPLOYMENT_TARGET=4.0
    export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -L/Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Products/Debug-iphonesimulator -F/Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Products/Debug-iphonesimulator -F/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/PrivateFrameworks -filelist /Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Intermediates/VAFieldTest.build/Debug-iphonesimulator/VAFieldTest.build/Objects-normal/i386/VAFieldTest.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=4.0 -framework Foundation -framework UIKit -framework CoreGraphics -framework CoreTelephony -weak_framework VoiceServices -Xlinker -dependency_info -Xlinker /Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Intermediates/VAFieldTest.build/Debug-iphonesimulator/VAFieldTest.build/Objects-normal/i386/VAFieldTest_dependency_info.dat -o /Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Products/Debug-iphonesimulator/VAFieldTest.app/VAFieldTest

ld: -pie can only be used when targeting iOS 4.2 or later
clang: error: linker command failed with exit code 1 (use -v to see invocation)
起初我认为这是由于新库的链接,但经过检查,构建依赖项已经被包括在内,这没有任何帮助。我曾想过自己调用核心电话方法,但官方文档中没有列出在iOS 8.3中访问这些核心功能的方法。列出的方法可在开发人员文档库中找到,但不包含所需的方法


如何在iOS 8.3中获取RSSI值?我使用的是Xcode 6.4 beta。

这已经不可能了,显然是修补漏洞的副作用

您可以使用以下方法获得信号强度:

UIApplication *app = [UIApplication sharedApplication];
NSArray *subviews = [[[app valueForKey:@"statusBar"] valueForKey:@"foregroundView"] subviews];
NSString *dataNetworkItemView = nil;

for (id subview in subviews) {
    if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarSignalStrengthItemView") class]]) {
        dataNetworkItemView = subview;
        break;
    }
}

int signalStrength = [[dataNetworkItemView valueForKey:@"signalStrengthRaw"] intValue];

NSLog(@"signal %d", signalStrength);

想开发一个应用程序,存储用户的位置和他的信号强度在定期的时间步长,并使用它进行一些统计分析。不幸的是,这似乎是一条死胡同。Android看起来也有点复杂。。。。ThnxWow。那是。。聪明。将“UIStatusBarSignalStrengthHitemView”替换为“UIStatusBarDataNetworkItemView”,将“signalStrengthRaw”替换为“wifiStrengthBars”。不幸的是,“wifiStrengthRaw”总是返回0。看起来很好-但是,这不算是使用私有API,因此会被拒绝吗?是的,它会被拒绝,因为它使用私有变量。此方法在后台不起作用。任何人都知道当应用程序在后台时,我们如何获得手机信号强度。