iPhone Simulator magneticHeading? - ios

I have created an app that I want to know the magneticHeading. I have coded it in every way possible that I thought it would work. From there I have been testing my app on the simulator but it wont give me the magneticHeading Value.
I have looked for this before and I believe the answer is that the simulator will not give you this value. I haven't found anything that flat out said it so I just want to check with the community for my exact situation:
Will the iPhone simulator give you the magneticHeading Data.
Would it with a gpx file?

Your assumptions are correct because the simulator does not have the required hardware, which in this case is the magnetometer. You can determine way points, routes etc with a .gpx file but as far as orienting the display to correlate with the direction the user is facing, you'll need a compass. Testing on an actual device with the required hardware would therefor be preferable.
The use of location services requires user authorization. In addition, some location services require the presence of specific hardware on the given device. For example, heading information is available only on devices that contain a hardware compass.
This is taken from CLLocationManager Class Reference
For a list of devices that have the magnetometer hardware have a look at iOS Device Compatibility Reference

Related

Manipulating Core Location data manually [duplicate]

We are looking for a way to send GPS location to iPhone or iPad through bluetooth. The benefits of doing so is that an external GPS device could produce more accurate location than the build-in GPS device in iOS. For our testing purposes, it would also be nice to be able to produce GPS manually by QAs.
We are pretty sure this is possible but we don't know how. We heard about this kind of external GPS device from one of our customers. Simple googling we found this one this device, which does exactly what we are looking for.
We know that it is possible to generate fake GPS location using GPX file through Xcode. Please refer to this SO for more details. But this is not what we are looking for. We don't want to teach the QA how to build and debug with Xcode.
In a nutshell, we want to know how to send GPS location to iOS device via bluetooth. Eventually, we would like to build a simple app (maybe on Mac) and we can set up some GPS locations for testing.
P.S.: A similar question was asked a couple of years ago but it seems very much outdated. This link explains the supported supported bluetooth profiles by Apple. But I don't see anything related.
Any link to sample code or documentation will be very much appreciated. Thank you!
As far as we know, we are not able to send GPS location to our device via Bluetooth. Apple only allow pairing with a small set of known Bluetooth GPS manufactures.

iPad: Get User Location

I am working on an application that needs the location of where the user is entering information. This iOS application may run on iPhone and iPad. Given that iPhone typically come with cellular service and thus a GPS chip I don't think this will be an issue. However what about iPad? If I am developing for iPad (that will not have cellular service) how will I be able to retrieve the user's current GPS location. This would be easy to do with the CoreLocation framework if I knew I had that capability, but on iPad I can't always be certain it will be there.
How would I get around this to get the GPS coordinates, or some other way of getting the user's relative location?
Location services are available even on iPad, using WiFi.
Take a look at this Article from Apple:
https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html
Specifically, you can set up your app to require either location services, or to require a 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.
There are two sources in IOS devices to get user location, one is through "GPS" and the other one is "WIFI". Your must be having one of them to retrieve user's location. If your IPad is connected to a "WIFI network" even if it doesn't have a cellular connection, then it's not an issue.

Send GPS location to iOS device via bluetooch

We are looking for a way to send GPS location to iPhone or iPad through bluetooth. The benefits of doing so is that an external GPS device could produce more accurate location than the build-in GPS device in iOS. For our testing purposes, it would also be nice to be able to produce GPS manually by QAs.
We are pretty sure this is possible but we don't know how. We heard about this kind of external GPS device from one of our customers. Simple googling we found this one this device, which does exactly what we are looking for.
We know that it is possible to generate fake GPS location using GPX file through Xcode. Please refer to this SO for more details. But this is not what we are looking for. We don't want to teach the QA how to build and debug with Xcode.
In a nutshell, we want to know how to send GPS location to iOS device via bluetooth. Eventually, we would like to build a simple app (maybe on Mac) and we can set up some GPS locations for testing.
P.S.: A similar question was asked a couple of years ago but it seems very much outdated. This link explains the supported supported bluetooth profiles by Apple. But I don't see anything related.
Any link to sample code or documentation will be very much appreciated. Thank you!
As far as we know, we are not able to send GPS location to our device via Bluetooth. Apple only allow pairing with a small set of known Bluetooth GPS manufactures.

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

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?
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:
Query the device type and determine if it has GPS based on that. This is described here.
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. :)
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.
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)
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

How to make my app work only on iPhone 3G and higher

Is there a way to limit devices, i.e. iPhone 3G and higher, and not to support the iPhone 2G and lower. I can't find an element that is different. I would limit it to iOS 3.1, however I'm pretty sure that iPhone 2G and lower can run iOS 3.1.
There is a similar question about 3GS+. But 3G+? That might be tough. I don't see anything in the UIRequiredDeviceCapabilities that specifies the 3G radio. You could try using another key based on a hardware feature that the 3G has that the iPhone doesn't, but then you risk getting your build rejected by Apple.
Using run-time checks to detect hardware as Sam Ritchie also suggests is also a bad idea since (1) that will most certainly trigger a rejection, and if it doesn't (2) people with older devices will be able to purchase the app, only to find out it won't run, and they will complain, which will cause Apple to pull your app from sale anyway.
The only way to do it without resorting to things that Apple disallows is to target iOS 4.0 or higher. 4.0 does not run on the 1st generation. I realize you want to target iOS 3.1, but you either allow all devices, or target 4.0.
One nice way to do this would be to check out the UIDevice-Extension project on github. It gives you the ability to detect what hardware you're running on.
I suspect that the way to solve this would be to examine your app and figure out what exactly you don't want a user of an earlier phone to be able to access. Once you've narrows down the feature, you can easily check for the existence of that specific feature on the device. To do this, include the UIDeviceRequiredCapabilities key in Info.plist, and take a look at Apple's Build Time Configuration guide for a list of all possible values. You'll find it under the "Declaring the Required Device Capabilities" heading. Good luck!
Add some minimal Location based functionality to your app (so that Apple can't reject it), and then add the "gps" key to your app's UIRequiredDeviceCapabilities.
But consider that the percentage of 2G's users who actually still buy apps appears to currently be microscopic, and not worth bothering over. Just state the lack of support for these devices in your description.
This answer seems to answer your question:
https://stackoverflow.com/a/4128248/285694
The solution is to require "armv7" in the required device capabilities xml.

Resources