Reputation: 240
I'm messing about with React Native, and I came across this other post: Permission Denied Geolocation React Native. I wanted to append another question onto that post, but I do not have a high enough ranking to make comments.
My question is, does the iOS simulator not have the current location ability automatically? I know that macOS apps in Xcode have full networking and geolocation abilities, thus I don't need to specify a location when using CLLocationManager. I'm trying to understand the reasoning and limitations behind the iOS simulator; specifically as to why it would not simply behave like any other VM and just use the host's wifi for basic network and location settings? Why would I need to specify a location upon simulator startup?
Thanks in advance!
Upvotes: 0
Views: 906
Reputation: 57
To get the current location in simulator you have to add GPX file in your project.
Project->New file -> iOS->Resource->select GPX file
Here is a simple GPX file . You just change the name and lat/long.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<gpx
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
version="1.1"
creator="gpx-poi.com">
<wpt lat="lat" lon="long">
<name>YourLocation</name>
</wpt>
</gpx>
Upvotes: 0
Reputation: 207
As far as I know, apple does not support 'real' gps through the iOS simulator, but it does provide you with a variety of other options as you can see on this screenshot I made for you:
Hope that helps!
Upvotes: 1