How can I tell if an iOS device has a GPS?

后端 未结 4 2054
故里飘歌
故里飘歌 2020-12-10 13:14

For an iPad, or iPod touch, is there a way to find out if the device has GPS?

Extra Credit: What if the iPad itself does not, but it is connected to a third-party GP

4条回答
  •  眼角桃花
    2020-12-10 14:00

    Apple does not provide a function to directly query the device if it has GPS capabilities or not. There are two possible solutions to your problem:

    1. Query the device type and determine if it has GPS based on that. This is described here.

    2. The way Apple recommends: have a look at their documentation here (Section "Determining the available Hardware Support"). Basically you create an instance of CLLocationManager and set the desired accuracy to the highest level, after that you can query its accuracy; if it's not very accurate, it's likely that the device does not have GPS.

    Hope this helps. :)

提交回复
热议问题