简体   繁体   English

iOS:我可以手动将 wifi 网络与地理位置关联吗?

[英]iOS: Can I manually associate wifi network with geographic location?

Is it possible to make the phone to "know" that a specific wifi network is at specific geographic location?是否可以让手机“知道”特定的 wifi 网络位于特定的地理位置?

if (answer == YES)
{  
    than how?
}
else
{
    can the phone figure this out by himself?  
}

Another similar question: is there any way to start monitor a region with accuracy of ~100m but telling the CLLocationManager to use only by wifi networks and cellular antenas?另一个类似的问题:有没有什么方法可以开始监控一个精度为~100m 的区域,但告诉 CLLocationManager只能由 wifi 网络和蜂窝天线使用? Because I don't want to power up the GPS no matter what...因为无论如何我都不想给 GPS 加电...

Thanks!谢谢!

iPhone positioning sucks and there is nothing you can do. iPhone定位很烂,你无能为力。

If you jailbreak your device you can use the Apple80211 private framework to look up the available Wi-Fi networks and their signal strength.如果您越狱您的设备,您可以使用Apple80211私有框架来查找可用的 Wi-Fi 网络及其信号强度。 But that also means your app will get rejected.但这也意味着您的应用将被拒绝。

If the user manually connects to a Wi-Fi you can see the MAC addresses of the devices on that network and use that to guess your position.如果用户手动连接到 Wi-Fi ,您可以看到该网络上设备的 MAC 地址并使用它来猜测您的 position。 Since Wi-Fi has a range of 50 meters, that's the accuracy you get.由于 Wi-Fi 的范围为 50 米,这就是您获得的准确度。

All the positioning system is transparent for an App Store developer, meaning an application can't disable the GPS, list Wi-Fis, or read the signal strength.所有的定位系统对于 App Store 开发人员来说都是透明的,这意味着应用程序无法禁用 GPS、列出 Wi-Fi 或读取信号强度。 The most you can do is guess if you are positioning through GPS or Wi-Fi looking at the altitude parameter.您最多只能猜测您是通过 GPS 定位还是通过 Wi-Fi 查看海拔参数。

Use case: You are in a mall and you want to know where shop X is.用例:您在购物中心,想知道商店 X 在哪里。 Probably there is no GPS signal, and if you install a GPS repeater you get the position of the antenna of that repeater, not your position.可能没有 GPS 信号,如果您安装 GPS 中继器,您将获得该中继器天线的 position,而不是您的 Z46757FE078DDEAZ83A。 Even if you install a dozen Wi-Fi access points you can't ask the user to manually connect because it's a hassle, and even if he did he would get 50-100 meters accuracy, and then there is the security risk of connecting here and there.即使你安装了十几个Wi-Fi接入点,你也不能要求用户手动连接,因为这很麻烦,即使他这样做了他也会得到50-100米的精度,然后这里连接存在安全风险在那里。 Basically you are screwed.基本上你被搞砸了。

I completely agree with Jano: apple logic has more sense than other solutions.我完全同意 Jano:苹果逻辑比其他解决方案更有意义。 Anyway You can easy get your WIFI network id:无论如何,您可以轻松获取您的 WIFI 网络 ID:

-(void)LogInfo:(NSDictionary*)info forKey:(NSString*)key;
{
    NSString* temp;
    temp = [info objectForKey: key];
    NSLog(temp);
}


- (void)fetchSSIDInfo
{
    NSArray *ifs = (id)CNCopySupportedInterfaces();
    NSDictionary* info = nil;
    for (NSString *ifnam in ifs)
    {
        info = (id)CNCopyCurrentNetworkInfo((CFStringRef)ifnam);
        NSString *temp = [NSString stringWithFormat:@"%@", [info description]];
        [self AddToLog: temp];

        [self LogInfo:info forKey:@"BSSID"];
        [self LogInfo:info forKey:@"SSID"];
        [self LogInfo:info forKey:@"SSIDDATA"];
        [info release];
    }

    [ifs release];

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM