I'm having a problem with location on simulator.
It is working when I run the app on my device but it does not work when I run it in the iOS(5) Simulator.
Any solution?
Location services not working in simulator since 4. You can set current location latitude/longitude via Simulator menu -> Debug -> Location -> Custom location...
Related
I am really curious about this issue. i have added following things in plist
1.NSLocationAlwaysUsageDescription -> YES
2.NSLocationWhenInUseUsageDescription -> YES
but when I try to change "allow location access" , iOS settings App crashed in iPhone 5(iOS8)..it works on iPhone 4 and 4s (iOS7).can anyone help me to solve this issue ?
Finally I found answer. we need to give String only for NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription.. I gave Boolean value for these services..that was cause of issue..
My App tracks your location.
With iOS8 I had to change how it was starting location services.
I got this working with
[self.locationManager requestAlwaysAuthorization];
and adding NSLocationAlwaysUsageDescription to the plist file.
The app now gets your location when run on a device, but not in the simulator.
Any clues on how to get this to work in the simulator? It used to!!!
In the iOS Simulator, select Debug > Location, then choose your location.
I decided to post this in case anyone else had the same issue. I got the simulator to respond to location changes again by adding NSLocationWhenInUseUsageDescription back into the plist file. I had removed it since my app needs the Always permission instead of WhenInUse. By adding this back to the plist the simulator is now happy. I did not have this issue on the physical device, just the simulator.
I am using Xcode version 4.5.1 and OS X version 10.8.2.
I downloaded the CurrentAddress sample project (ver 1.2) and when I run it the first time it prompts "'CurAddress' Would you like to use your current location", to which I say OK. I cannot figure out from where the code is getting the location that it ends up using, which is in or near San Francisco, lat 37.7858, long -122.406. I have looked all over the project and cannot see where these values are coming from. Thanks for any help.
this comes from CLLocationManager, which either will get that data from the GPS sensor in your iphone device, or from the GPS simulation built in in iPhone Simulator.
San Francisco is the default GPS simulation track, near Apples Headquarter.
If you are running in simulator, go to simulator debug menu -> Location -> you can set any location here. If I am correct, your CLLocationManager should pick the current location in simulator from here. In device, it should pick the current location, if the same is enabled.
I've made Appcelerator Titanium Module for fetching device's rotaion and location. Source can be found on GitHub.
The problem is that it fetches only one cached location but device motion data is OK and it is refreshing.
I don't use delegate, I pull that data in my Titanium Javascript Code.
If I set "City Run" in Simulator -> Debug -> Location nothing happens. The same cached location is returning.
Pulling of location is OK because I tried with native app wich does this:
textView.text = [NSString stringWithFormat:#"%f %f\n%#",
locationManager.location.coordinate.longitude,
locationManager.location.coordinate.latitude,
textView.text];
And it is working in simulator and on device.
But the same code as you can see on GitHub is not working as Titanium module.
Any ideas?
EDIT:
I am looking at GeolocationModule src and I see nothing special there.
As I said, my code in my module has to work since it is working in native app. "Only" problem is that it is not updating location and it always returns me that cached location.
The answer is to put ENSURE_UI_THREAD at the top of function that starts location updating.
For 5.0, i use the clgeocoder and clplacemark, but i get "1 stockton street" everytime. I believe 1 stockton st is the address of an apple store in s.f. The Mk classes work for the same program for younger version simulators.
Why is the 5.0 simulator defaulting to the store's location?
Check out the Location Simulation section in the release notes for Xcode 4.2
You can also simulate movement using a GPX file, check this out Simulate Location including movement in Xcode 4.2 / iOS5
Earlier versions of iOS simulator have no location while iOS 5 Simulator have the ability to simulate location (note the location arrow at the bottom of xCode screen). I don't know how you simulate location changes in your code, but it may happen, that simulator activity interrupts your location changes chain.