I want to read almost a million addresses in foor loop using CLGeocoder and save their coordinates. I have also put a 2 second pause in each loop, but every time I want to run the program in Xcode, after 200 or 300 iterations, the program closes suddenly. Does anyone know the reason? Is there a problem with the code? here is my code : func createCSV(from recArray:[Dictionary]) { var csvString = (Adresse);(latitute );(longitude)nn for dct in recArray { csvString = csvString.appending((String(describing:dct[Adresse]!));(String(describing: dct[latitute]!));(String(describing: dct[longitude]!))n) } let fileManager = FileManager.default do { let path = try fileManager.url(for: .documentDirectory, in: .allDomainsMask, appropriateFor: nil, create: false) let fileURL = path.appendingPathComponent(CSVRec.csv) try csvString.write(to: fileURL, atomically: true, encoding: .utf8) } catch { print(error creating file) } } func getLocation(for address: String) async throws -> CLLocationCoordinate2D { guard let coordinate
Topic:
App & System Services
SubTopic:
Maps & Location
Tags:
MapKit JS
Swift Playground
Playground Support