-->

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

2019-01-18 22:51发布

问题:

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 GPS unit? Can I determine this?

回答1:

For iOS 6 or higher, you might want to try

+ (BOOL)[CLLocationManager deferredLocationUpdatesAvailable]

According to the documentation:

Deferred location updates require the presence of GPS hardware and may not be supported on all iOS devices.



回答2:

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. :)



回答3:

Only GPS can deliver the location attributes: course and speed.
And as a general rule, you need GPS for precise location, a device whitout GPS will deliver a location.getHoricontalAccuracy() higher than 30- 40m. (Using accuracy setting of CLLLocationAccuracyBest)

So In that case you dont have an accurate position and can ignore that always. (Independnet if the device has GPS or not)



回答4:

Download altimeter or similar app. Turn off cell data and wifi before you ever use the downloaded app. Then launch the app and see if it will give you Your current altitude. If it works you have GPS if it doesn't then you don't