iPad:获取用户位置
iPad: Get User Location
我正在开发一个需要用户输入信息位置的应用程序。此 iOS 应用程序可能 运行 iPhone 和 iPad。鉴于 iPhone 通常带有蜂窝服务和 GPS 芯片,我认为这不会成为问题。但是 iPad 呢?如果我正在为 iPad( 没有蜂窝服务)开发,我将如何检索用户的当前 GPS 位置。如果我知道我有这种能力,使用 CoreLocation
框架会很容易做到这一点,但在 iPad 上我不能总是确定它会在那里。
我如何绕过这个问题来获取 GPS 坐标,或者其他获取用户相对位置的方法?
即使在 iPad 上使用 WiFi 也可以使用定位服务。
看看这篇来自 Apple 的文章:
具体来说,您可以将您的应用设置为需要定位服务或需要 GPS:
Requiring the Presence of Location Services in an iOS App
If your iOS app requires location services to function properly,
include the UIRequiredDeviceCapabilities key in the app’s Info.plist
file. The App Store uses the information in this key to prevent users
from downloading apps to devices that don’t contain the listed
features.
The value for the UIRequiredDeviceCapabilities is an array of strings
indicating the features that your app requires. Two strings are
relevant to location services:
- Include the location-services string if you require location
services in general.
- Include the gps string if your app requires
the accuracy offered only by GPS hardware.
IOS 设备中有两种获取用户位置的来源,一种是通过"GPS",另一种是"WIFI"。您必须拥有其中之一才能检索用户的位置。如果您的 IPad 已连接到 "WIFI network",即使它没有蜂窝网络连接,也不是问题。
我正在开发一个需要用户输入信息位置的应用程序。此 iOS 应用程序可能 运行 iPhone 和 iPad。鉴于 iPhone 通常带有蜂窝服务和 GPS 芯片,我认为这不会成为问题。但是 iPad 呢?如果我正在为 iPad( 没有蜂窝服务)开发,我将如何检索用户的当前 GPS 位置。如果我知道我有这种能力,使用 CoreLocation
框架会很容易做到这一点,但在 iPad 上我不能总是确定它会在那里。
我如何绕过这个问题来获取 GPS 坐标,或者其他获取用户相对位置的方法?
即使在 iPad 上使用 WiFi 也可以使用定位服务。
看看这篇来自 Apple 的文章:
具体来说,您可以将您的应用设置为需要定位服务或需要 GPS:
Requiring the Presence of Location Services in an iOS App
If your iOS app requires location services to function properly, include the UIRequiredDeviceCapabilities key in the app’s Info.plist file. The App Store uses the information in this key to prevent users from downloading apps to devices that don’t contain the listed features.
The value for the UIRequiredDeviceCapabilities is an array of strings indicating the features that your app requires. Two strings are relevant to location services:
- Include the location-services string if you require location services in general.
- Include the gps string if your app requires the accuracy offered only by GPS hardware.
IOS 设备中有两种获取用户位置的来源,一种是通过"GPS",另一种是"WIFI"。您必须拥有其中之一才能检索用户的位置。如果您的 IPad 已连接到 "WIFI network",即使它没有蜂窝网络连接,也不是问题。