Questions tagged [clgeocoder]

The CLGeocoder class provides services for converting between a coordinate (specified as a latitude and longitude) and the user-friendly representation of that coordinate.

The CLGeocoder class provides services for converting between a coordinate (specified as a latitude and longitude) and the user-friendly representation of that coordinate. A user-friendly representation of the coordinate typically consists of the street, city, state, and country information corresponding to the given location, but it may also contain a relevant point of interest, landmarks, or other identifying information. A geocoder object is a single-shot object that works with a network-based service to look up placemark information for its specified coordinate value.

http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLGeocoder_class

227 questions
0
votes
2 answers

How to wait until CLGeocoder finish its work

I have following function geocoding address from GPS coordinates private func getAddressFromLocation(forLocation: CLLocationCoordinate2D) { let geoCoder = CLGeocoder() geoCoder.reverseGeocodeLocation(CLLocation(latitude:…
Dawy
  • 770
  • 6
  • 23
0
votes
0 answers

current location alway 00000.00, 00000.00

I am trying to get my current location and the reverseGeoCode it for an address but I keep getting my location as long 00000.00 and lat 00000.00 Here is my code locationManager = [[CLLocationManager alloc] init]; locationManager.delegate =…
user1114881
  • 731
  • 1
  • 12
  • 25
0
votes
1 answer

MapKit forward geocoding that is not based on ONLY addresses?

So I made a super simple forward geocoding function with MapKit: func getCoordinates(from address: String) { CLGeocoder().geocodeAddressString(address) { placemark, error in guard error == nil && placemark != nil else { …
nickcoding
  • 305
  • 8
  • 35
0
votes
1 answer

SwiftUI How to toggle a Bool in a Struct from an ObservableObject class and show alert to notify user

I have a method in my class that opens a map when given an address string. Trying to show an alert in a view by toggling a boolean in a method in the class. I can't figure out how to toggle the boolean in the class method. This is what I tried. The…
Mike Haslam
  • 245
  • 3
  • 21
0
votes
1 answer

CLGeocoder().geocodeAddressString error codes

I am working on a project where I use CLGeocoder to determine the placemarks for a particular location. Very simple call like this. CLGeocoder().geocodeAddressString(location) { (placemarks, error) in if let error = error { …
Stewart Lynch
  • 875
  • 9
  • 26
0
votes
1 answer

CLLocationManager() requestWhenInUseAuthorization() shows up and disappears on simulator and does not show up on actual device

I want to know the user's current location. But since I want to get this location from multiple places, I made a function for it instead of setting a particular UIViewController as delegate handler. Methods to get user location: func…
Parth
  • 2,682
  • 1
  • 20
  • 39
0
votes
1 answer

Swift 5 reverseGeocodeLocation() result in deprecated addressDictionary

I'm using a CLGeoCoder instance to get the city and country of a given set of coordinates (latitude and longitude) through its method reverseGeocodeLocation(). The documentation specifies that this data should be in CLPlacemark's country and…
Omar Khodr
  • 93
  • 6
0
votes
1 answer

How to make a function that return coordinates from address swift 4

Hi I want to receive the coordinates of an address. I made this function but not works. Return alway 0.0, 0.0 func getCoordinates(address: String)->(Double, Double){ DispatchQueue.main.async { let geoCoder = CLGeocoder() …
TheCesco88
  • 111
  • 4
  • 9
0
votes
1 answer

Cannot save the longitute and latitude from CLGeocoder()

I want to retrieve the longitute and latitude using an address as a string. I found this very useful post here: Convert address to coordinates swift But when I want to save the results in a double field and return it I can't. What I have done is…
Newboz
  • 69
  • 6
0
votes
1 answer

Reverse Geocode CLGeocoder Memory Leak

I am writing an app that uses Reverse Geocoding and the CLGeocoder command. I am using Xcode 11.3 and Swift 5. The code I am using is stock standard and works ie. I can perform reverse geocoding fine. The issue is that my app calls the reverse…
0
votes
1 answer

How make function of returning address, but not only getting address?

I'll make function of returning address String. But below function return empty String of "". How make return address function? let defaultLocation = CLLocation(latitude: 35.17944, longitude: 129.07556) func convertToPlaceMark(_ location:…
koreaMacGuy
  • 75
  • 2
  • 8
0
votes
1 answer

Xcode 10.3 Simulator issue? PHAsset location and date info from photo working only in one simulator

Using UIIMagePickerController to select a photo to display image with date, time and location from PHAsset. The problem is that it only works on one specific Simulator (iPhone XR). When I run it on a different simulator (eg. iPhone XS) the image…
yantronica
  • 353
  • 1
  • 3
  • 12
0
votes
1 answer

Unable to get postal code from CLGeocoder

i am trying to get postal code from CLGeocoder but app is crashing with error *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithString:]: nil argument' here is my code CLPlacemark…
Vix Hunk
  • 303
  • 4
  • 17
0
votes
1 answer

How to call CLGeocoder method synchronously

I have in ViewController code var location = CLLocation() DispatchQueue.global().sync { let objLocationManager = clsLocationManager() location = objLocationManager.findLocationByAddress(address: self.txtTo.stringValue) } …
Dawy
  • 770
  • 6
  • 23
0
votes
0 answers

Determine building name from CLGeocoder

Is it possible to determine the building (or another landmark) your in with CLGeocoder or any other Apple location service SDK? I can see the address of my current location using long & lat using CLGeocoder. However, I would also like to return the…
Paul S.
  • 1,342
  • 4
  • 22
  • 43