0

Possible Duplicate:
How to get the user’s current location by code in iphone app?

I want to snatch the current location LONG and LATs when my app is loading, without being visible.

I'm not trying to run the app in the background or track the location of the phone in the background. Just get the current co-ordinates, if available.

Is there a cleaner way of doing this than create a traditional mapView and hiding it?

Community
  • 1
  • 1
Edward Hasted
  • 3,201
  • 8
  • 30
  • 48
  • What does Android have to do with Xcode? Do you mean that you want to do something like that on iOS? – zneak Nov 08 '12 at 17:02
  • 2
    See the [CLLocationManager class](http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html). –  Nov 08 '12 at 17:18
  • NO - I want to do this as a background snatch and not your standard lets display on a map or track infinitum. I had checked before. – Edward Hasted Nov 08 '12 at 18:44
  • Anna, unfortunately I don't have you fluency of CoreLocation to work everything backward from the Apple Bible, although I am sure that if I did the answer is there. Is there an working example I can dissect retrospectively? – Edward Hasted Nov 08 '12 at 20:00
  • 2
    Try reading [Getting the User's Location](http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html#//apple_ref/doc/uid/TP40009497-CH2-SW9) from the Location Awareness Programming Guide. However, searching for the keywords Core Location and CLLocationManager on this site and elsewhere should result in plenty of examples. –  Nov 08 '12 at 20:09
  • Thanks Anna, I bow to your superior knowledge on teh subject. Created a methods along the lnes of - (NSString *)deviceLocationLongitude { NSString *theLongitude = [NSString stringWithFormat:@"%f", locationManager.location.coordinate.longitude]; return theLongitude; } to return the long/lats in the loading views and then pass the data to the relevant map page later on. – Edward Hasted Nov 09 '12 at 17:52

0 Answers0