2

我想只允许拥有 3G 手机的用户使用特定的 GPS 功能。在允许使用该功能之前,如何在设备上运行检查?

4

2 回答 2

4

以下代码允许您确定正在使用的确切设备,但我首先会考虑一个事实,即 3G 设备实际上可能无法获得 GPS 锁定,因为这样做的过程非常缓慢并且需要更多或天空的视野不太清晰。

对于 iPhone 3G,此方法的结果将是 iPhone1,2

- (NSString *)deviceModel
{
    NSString *deviceModel = nil;
    char buffer[32];
    size_t length = sizeof(buffer);
    if (sysctlbyname("hw.machine", &buffer, &length, NULL, 0) == 0) {
        deviceModel = [[NSString alloc] initWithCString:buffer encoding:NSASCIIStringEncoding];
    }
    return [deviceModel autorelease];
}
于 2008-11-19T22:22:51.810 回答
0

Why would you stop 1g phone users from using location services? If you are near mapped WiFi you can get decent location results even without a GPS on the device.

Instead you should base your choice of what to do around the current location accuracy, if that is a reason why you seek to disable anything.

于 2010-03-21T05:38:28.320 回答