I am trying to make a jogging app which will track where the user ran. It will draw a line on the map where the user is running. My problem is that how to test such an app. Is there anyway I can dynamically change the user location which will fire the didUpdateUserLocation delegate method?
The iOS Simulator supports that feature in the current beta version. You can even simulate a dynamically updating location.
Related
How to stop updating user position, these to functions no longer exist :
mapView.locationManager.stopUpdatingHeading()
mapView.locationManager.stopUpdatingLocation()
The goal is to use SimulatedLocationManager, to simulate a navigation but the real position keeps updating.
thanks
Trying to develop my first application which will just be side loaded to my device. I am unsure if I can even do what I'm looking for; I'm trying to change the current location on my device via my application. I know this is done with the Xcode debugger but can it be done solely on the application with no connection to the computer? Basically I have a few buttons, each one I want to change the location to somewhere different. Do I just code the coordinates to set with the button and thats all? Will this show on my maps application and such? Thanks.
What you ask is not possible. The GPS hardware is what reports location to the phone. Xcode is able to do this because it is reporting location to the simulator, which has no GPS hardware on its own
I'm running on IOS8 simulator and counter this problem:
GMSMapView is able to load map but it didn't ask for Location's permission, thus it could not update current user's location. (I did set a custom location, using GPX file)
However, GMSMapView still works fine on IOS 7.1, 7.0 ...
My code is simple, init mapView, add it to controller's view and using KVO myLocation to observer location's change.
What should I do now ?
Google Maps SDK v1.8.1 doesn't request the location authorization that is needed in iOS8, so you need to do this in your application.
Use the CLLocationManager's requestWhenInUseAuthorization method, and in the authorization changed delegate, enable location updates in the map view when authorization can be given.
Also, don't forget to add the correct keys in the info.plist to explain to your users why you need their location, as without this the call to requestWhenInUseAuthorization don't do anything.
I am trying to set a bounds between the users location and a selected marker. I can set everything up properly but when I try to use the users location (mapView_.myLocation.coordinate) it says the lat and long are both 0. I did create a button to center the camera on the users location and it gets the lat and long just fine. Does not make any sense to me. Also I don't have a device set up to test so I am using xcodes iOS simulator with a location put into the simulator (is that where my problem is?). Any ideas?
Are you trying to access myLocation.coordinate from loadView or similar, ie when the app first starts up?
Generally when enabling location services the app doesn't receive a location update immediately, it comes through after some delay. So it's possible that myLocation.coordinate won't be valid in loadView, but will have a value set some time later (which is why it works with your button).
You could perhaps listen for changes to myLocation, and then set your bounds when it changes to something.
I have a MKMapView & I use it to display user's current location. It works normal when I first load it in the App. But when I press Home button to put the App to background & call it back from background, the map prompts it is unable to find the user's location.
I was thinking is the MKMapView takes time to search for user's location, and when I call it back from background, it does not have enough time to load the location service ?
iOS5 SDK, xCode 4.3 is used.
If I understand your question correctly, your problem is that when your app resumes (becomes active), mapView.userLocation returns nil. Although I haven't tested this, I suspect it is because the mapView will need some time to relocate the user. You can get around this by adding your logic to the appropriate delegate method instead, which is - (void) mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation, if memory serves me right (you might want to verify that, though).
EDIT: Make sure you test location-related code on a device, since its behaviour might differ from the simulator.