How can I tell if an iOS device has a GPS?
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.
Detect GPS Hardware in iphone
Even though you can not determine this using the SDK, you may exploit your knowledge of current models. If you limit yourself to iPhone 3G, iPhone 3GS and iPod Touch 2nd generation (I do not personally support older iPhone edge or iPod Touch 1st generation), then you already know that the iPhone models ship with a real AGPS unit while the iPod Touch 2nd generation can use - if and when available - geotagged wifi hot spots. You may then use the following method to determine the model you are running on:
- (NSString *) deviceModel{
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *answer = malloc(size);
sysctlbyname("hw.machine", answer, &size, NULL, 0);
NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];
free(answer);
return results;
}
The method returns @"iPhone2,1" for the 3GS, @"iPhone1,2" for the 3G and @"iPod2,1" for the ipod touch 2nd generation; you call it as follows
NSString *deviceModel = [[self deviceModel] retain];
and use it as follows:
if([self.deviceModel isEqualToString:@"Pod2,1"]){
// no real GPS unit available
// no camera available
...
}
Detect GPS in iOS device with CoreTelephony
After doing some digging, I've found this article from Apple which, as a footnote, explains that:
iOS devices without a cellular connection use only Wi-Fi for Location Services (if a Wi-Fi network is available).
GPS is available [only] on iPhone and iPad Wi-Fi + 3G models.
So it seems that detecting a cellular connection is a reliable way to determine whether or not and iOS device has a GPS unit. No cellular connection, no GPS.
Note that iOS supports external GPS units through bluetooth and dock connector. The above methods will tell whether the device has a internal GPS but not whether LocationManager will be able to provide GPS driven location updates.
Related Topics
Remove Uiwebview's Internal Cache
Pass Uicollectionview Touch Event to Its Parent Uitableviewcell
Sort Array by Distance Near User Location from Firebase
Understanding Model-View-Controller
Uiwebview Not Go to Didfailloadwitherror When Weblink Not Found
How to Create a Uiimage with Uibezierpath
iOS App Getting Throttled from Local Searches
Apns Push Notifications Not Working on Production
Swift - Add Gesture Recognizer to Object in Table Cell
Game Center Login Dialog Not Shown Again After Cancelling It for the First Time (Ios7)
How to Properly Send an Image to Cloudkit as Ckasset
Error Using Swift - Instance Member Cannot Be Used on Type 'Viewcontroller'
Open Viewcontroller from Tab Like in Instagram Camera Page on iOS
How to Record a Video with Augmented Reality
None of Your Accounts Are a Member, Code Signing Errors After Upgrading to Xcode 8
Multiple Uialertcontrollers in iOS