Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJiri Stepanek
10,740 PointsHow to get longitude and latitude? Swift
Hey there, I tryed to understand CLGeocoder class in CoreLocation framework but my app seems to not working :/ so I decided to ask you there. I wanna get longitude and latitude of my device location and print it for example. How can i do that?
1 Answer
Jayden Spring
8,625 PointsHi Jiri,
http://rshankar.com/get-your-current-address-in-swift/
This article provides a good example. Hope this helps.
Jiri Stepanek
10,740 PointsJiri Stepanek
10,740 PointsNope, It says "Error while updating location The operation couldn’t be completed. (kCLErrorDomain error 0.)"... :/
Jayden Spring
8,625 PointsJayden Spring
8,625 PointsAre you in the iOS Simulator? If so go to the Menu bar and under Debug > Location you can set your location. Or on the debug output (bottom drawer) in XCode you will see a location icon click that and set a simulated location.
That error means that it basically cant get a location. JAyden
Jiri Stepanek
10,740 PointsJiri Stepanek
10,740 PointsOMG thank u so much :D you were right!
Jayden Spring
8,625 PointsJayden Spring
8,625 PointsHave fun, you can be anywhere you want in the world with the simulator ;)